Permalink
Browse files

klipse bookmarklet

  • Loading branch information...
viebel committed Feb 11, 2017
1 parent eb27a29 commit 53e8a8d99e3e8983aea12d0d8c75f44aed0f3c89
Showing with 43 additions and 1 deletion.
  1. +1 −1 repl.md
  2. +41 −0 scripts/bookmarklet.js
  3. +1 −0 scripts/upload-bookmarklet
View
@@ -12,7 +12,7 @@ KLIPSE configuration is done with the url parameters:
* `cljs_in=<cljs_code>` - initial content of the `clojurescript` box ( `code` must be encoded properly)
* `cljs_in.gist=<gits_id>` - load code from a gist; e.g. http://app.klipse.tech?cljs_in.gist=viebel/368d3bec58d3ec47e935ad488bafb600&eval_only=1
* `cljs_in.gist=<gist_id>` - load code from a gist; e.g. http://app.klipse.tech?cljs_in.gist=viebel/368d3bec58d3ec47e935ad488bafb600&eval_only=1
* `container=1` - container more useful for UI stuff: instead of the compilation box, you have your klipse container
* `js_only=1` - display only `input` and `js` boxes
* `eval_only=1` - display only `input`, `eval` and `print` boxes
View
@@ -0,0 +1,41 @@
function addScript(url){
var s = document.createElement('script');
s.src = url;
document.body.appendChild(s);
}
function addCss(url) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = url;
link.media = 'all';
head.appendChild(link);
}
var domain_to_settings_map = {
'clojuredocs.org': {
selector: '.example-body'
},
'gist.github.com': {
selector: '.blob-wrapper.type-clojure'
},
'clojure.org' : {
selector: 'code.language-clojure'
}
};
function domain_to_settings(domain){
return domain_to_settings_map[domain];
}
console.log('klipse plugin loaded!!!');
window.klipse_settings = domain_to_settings(window.location.hostname);
if(window.klipse_settings) {
console.log('klipse plugin settings: ', window.klipse_settings);
addCss('https://storage.googleapis.com/app.klipse.tech/css/codemirror.css');
addScript('https://storage.googleapis.com/app.klipse.tech/plugin/js/klipse_plugin.js');
}
@@ -0,0 +1 @@
gsutil -h "Content-Type:application/javascript" cp scripts/bookmarklet.js gs://app.klipse.tech/bookmarklet.js

0 comments on commit 53e8a8d

Please sign in to comment.