Merge pull request #2 from jeroenvandijk/bookmarklet-fix1
Better error handling for Bookmarklet editor
This commit is contained in:
commit
c79f2cf22d
|
@ -18,10 +18,21 @@
|
||||||
|
|
||||||
(defn bookmarklet-href [code]
|
(defn bookmarklet-href [code]
|
||||||
(str "javascript:(function(){"
|
(str "javascript:(function(){"
|
||||||
|
"var runCode = function() {
|
||||||
|
try {
|
||||||
|
scittle.core.eval_string('" code "')
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error in code', error);
|
||||||
|
alert('Error running code, see console')
|
||||||
|
}
|
||||||
|
};"
|
||||||
|
"if(typeof scittle === 'undefined'){"
|
||||||
(append-tag :script {:src "https://borkdude.github.io/scittle/js/scittle.js"
|
(append-tag :script {:src "https://borkdude.github.io/scittle/js/scittle.js"
|
||||||
:onerror "function(){alert('Error loading ' + this.src)}"
|
:onerror "function(){alert('Error loading ' + this.src)}"
|
||||||
:onload (str "function(){scittle.core.eval_string('" code "')}")
|
:onload (str "runCode")
|
||||||
})
|
})
|
||||||
|
"} else {
|
||||||
|
runCode() }"
|
||||||
"})();"))
|
"})();"))
|
||||||
|
|
||||||
(defn workspace []
|
(defn workspace []
|
||||||
|
|
Loading…
Reference in a new issue