Hack in copying code between the two editors and fix recursive.css's body style overridding the slides

This commit is contained in:
miloignis committed 2023-04-08 14:05:48 -04:00
1 parent 6ef3392aa0
commit 4e7825cb2b
1 file changed
+26 -21
+26 -21
View File
@@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>My Awesome Presentation</title> <title>Kraken Quals Presentation</title>
<link id="theme" rel="stylesheet" type="text/css" href="recursive.css"/> <link id="theme" rel="stylesheet" type="text/css" href="recursive.css"/>
<link href="favicon.png" rel="icon" type="image/png"/> <link href="favicon.png" rel="icon" type="image/png"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css"> <style type="text/css">
.title > h1 { // unset recursive.css website version
font-size: 4em; body { max-width: unset; }
} .title > h1 { font-size: 4em; }
h1 { h1 { font-size: 2.5em; }
font-size: 2.5em; .rerun_container { position: relative; }
}
</style> </style>
</head> </head>
<body onload="loadEverything();"> <body onload="loadEverything();">
@@ -42,14 +41,17 @@ HEre's some test code:
<div class="editor" id="hello_editor">; Of course <div class="editor" id="hello_editor">; Of course
(println "Hello World") (println "Hello World")
; Just print 3 ; Just print 3
(println "Math works:" (+ 1 2)) (println "Math workssss:" (+ 1 2 4))
</div> </div>
<button class="run_button" onclick="executeKraken(hello_editor_jar.toString(), 'hello_editor_output')">Run</button> <br>
] ]
-- --
.rerun_container[
<pre><code class="remark_code" id="hello_editor_output">output here...</code></pre> <pre><code class="remark_code" id="hello_editor_output">output here...</code></pre>
<button class="run_button" onclick="executeKraken(hello_editor_jar[1].toString(), 'hello_editor_output')">Rerun</button> <br>
]
--- ---
# Another slideo # Another slideo
boro boro
@@ -64,20 +66,25 @@ import {CodeJar} from './codejar.js'
window.loadEverything = function() { window.loadEverything = function() {
var slideshow = remark.create(); var slideshow = remark.create();
document.querySelectorAll('.editor').forEach((editor_div) => { document.querySelectorAll('.editor').forEach((editor_div) => {
window[editor_div.id + "_jar"] = CodeJar(editor_div, hljs.highlightElement) if (window[editor_div.id + "_jar"] == undefined) {
window[editor_div.id + "_jar"] = []
}
window[editor_div.id + "_jar"].push(CodeJar(editor_div, hljs.highlightElement))
}); });
slideshow.on('showSlide', function (slide) { slideshow.on('showSlide', function (slide) {
console.log('Navigated to', slide) //console.log('Navigated to', slide)
if (slide.properties.continued == "true") {
let editor = null
for (const c of slide.content) { for (const c of slide.content) {
if (c.class == "run_container") { if (c.class == "run_container") {
console.log("found run_container", c) //console.log("found editor", c)
const re = /class="editor" id="([^"]+)"/; const re = /class="editor" id="([^"]+)"/;
let id = c.content[0].match(re)[1] let id = c.content[0].match(re)[1]
let editor = window[id + "_jar"] let editors = window[id + "_jar"]
console.log("Got editor", editor, "running kraken") if (slide.properties.continued == "true") {
executeKraken(editor.toString(), id + "_output") editors[1].updateCode(editors[0].toString())
//console.log("Got editors", editors, "running kraken")
executeKraken(editors[1].toString(), id + "_output")
} else {
editors[0].updateCode(editors[1].toString())
} }
} }
} }
@@ -99,13 +106,11 @@ window.loadEverything = function() {
}; };
function executeKraken(code, new_output_name) { function executeKraken(code, new_output_name) {
output_name = new_output_name output_name = new_output_name
document.getElementById(new_output_name).innerHTML = "running...\n"; document.getElementById(new_output_name).innerHTML = "";
Module.callMain(["-C", code]); Module.callMain(["-C", code]);
} }
</script> </script>
<script type="text/javascript" src="k_prime.js"></script> <script type="text/javascript" src="k_prime.js"></script>
<script type="text/javascript"> <script src="remark-latest.min.js"></script>
document.write(unescape("%3Cscript type='text/javascript'%3E" + "require%3Dfunction%28%29%7Bfunction%20e%28t%2Ca%2Cr%29%7Bfunction%20i%28n%2Co%29%7Bif%28%21a%5Bn%5D%29%7Bif%28%21t%5Bn%5D%29%7Bvar%20l%3D%22function%22%3D%3Dtypeof%20require%26%26require%3Bif%28%21o%26%26l%29return%20l%28n%2C%210%29%3Bif%28s%29return%20s%28n%2C%210%29%3Bvar%20c%3Dnew%20Error%28%22Cannot%20find%20module%20%27%22+n+%22%27%22%29%3Bthrow%20c.code%3D%22MODULE_NOT_FOUND%22%2Cc%7Dvar%20d%3Da%5Bn%5D%3D%7Bexports%3A%7B%7D%7D%3Bt%5Bn%5D%5B0%5D.call%28d.exports%2Cfunction%28e%29%7Breturn%20i%28t%5Bn%5D%5B1%5D%5Be%5D%7C%7Ce%29%7D%2Cd%2Cd.exports%2Ce%2Ct%2Ca%2Cr%29%7Dreturn%20a%5Bn%5D.exports%7Dfor%28var%20s%3D%22function%22%3D%3Dtypeof%20require%26%26require%2Cn%3D0%3Bn%3Cr.length%3Bn++%29i%28r%5Bn%5D%29%3Breturn%20i%7Dreturn%20e%7D%28%29%28%7B1%3A%5Bfunction%28e%2Ct%2Ca%29%7Bfunction%20r%28%29%7Bthis._events%3Dthis._events%7C%7C%7B%7D%2Cthis._maxListeners%3Dthis._maxListeners%7C%7Cvoid%200%7Dfunction%20i%28e%29%7Breturn%22function%22%3D%3Dtypeof%20e%7Dfunction%20s%28e%29%7Breturn%22number%22%3D%3Dtypeof%20e%7Dfunction%20n%28e%29%7Breturn%22object%22%3D%3Dtypeof%20e%26%26null%21%3D%3De%7Dfunction%20o%28e%29%7Breturn%20void%200%3D%3D%3De%7Dt.exports%3Dr%2Cr.EventEmitter%3Dr%2Cr.prototype._events%3Dvoid%200%2Cr.prototype._maxListeners%3Dvoid%200%2Cr.defaultMaxListeners%3D10%2Cr.prototype.setMaxListeners%3Dfunction%28e%29%7Bif%28%21s%28e%29%7C%7Ce%3C0%7C%7CisNaN%28e%29%29throw%20TypeError%28%22n%20must%20be%20a%20positive%20number%22%29%3Breturn%20this._maxListeners%3De%2Cthis%7D%2Cr.prototype.emit%3Dfunction%28e%29%7Bvar%20t%2Ca%2Cr%2Cs%2Cl%2Cc%3Bif%28this._events%7C%7C%28this._events%3D%7B%7D%29%2C%22error%22%3D%3D%3De%26%26%28%21this._events.error%7C%7Cn%28this._events.error%29%26%26%21this._events.error.length%29%29%7Bif%28%28t%3Darguments%5B1%5D%29instanceof%20Error%29throw%20t%3Bvar%20d%3Dnew%20Error%28%27Uncaught%2C%20unspecified%20%22error%22%20event.%20%28%27+t+%22%29%22%29%3Bthrow%20d.context%3Dt%2Cd%7Dif%28a%3Dthis._events%5Be%5D%2Co%28a%29%29return%211%3Bif%28i%28a%29%29switch%28arguments.length%29%7Bcase%201%3Aa.call%28this%29%3Bbreak%3Bcase%202%3Aa.call%28this%2Carguments%5B1%5D%29%3Bbreak%3Bcase%203%3Aa.call%28this%2Carguments%5B1%5D%2Carguments%5B2%5D%29%3Bbreak%3Bdefault%3As%3DArray.prototype.slice.call%28arguments%2C1%29%2Ca.apply%28this%2Cs%29%7Delse%20if%28n%28a%29%29for%28s%3DArray.prototype.slice.call%28arguments%2C1%29%2Cc%3Da.slice%28%29%2Cr%3Dc.length%2Cl%3D0%3Bl%3Cr%3Bl++%29c%5Bl%5D.apply%28this%2Cs%29%3Breturn%210%7D%2Cr.prototype.addListener%3Dfunction%28e%2Ct%29%7Bvar%20a%3Bif%28%21i%28t%29%29throw%20TypeError%28%22listener%20must%20be%20a%20function%22%29%3Breturn%20this._events%7C%7C%28this._events%3D%7B%7D%29%2Cthis._events.newListener%26%26this.emit%28%22newListener%22%2Ce%2Ci%28t.listener%29%3Ft.listener%3At%29%2Cthis._events%5Be%5D%3Fn%28this._events%5Be%5D%29%3Fthis._events%5Be%5D.push%28t%29%3Athis._events%5Be%5D%3D%5Bthis._events%5Be%5D%2Ct%5D%3Athis._events%5Be%5D%3Dt%2Cn%28this._events%5Be%5D%29%26%26%21this._events%5Be%5D.warned%26%26%28a%3Do%28this._maxListeners%29%3Fr.defaultMaxListeners%3Athis._maxListeners%29%26%26a%3E0%26%26this._events%5Be%5D.length%3Ea%26%26%28this._events%5Be%5D.warned%3D%210%2Cconsole.error%28%22%28node%29%20warning%3A%20possible%20EventEmitter%20memory%20leak%20detected.%20%25d%20listeners%20added.%20Use%20emitter.setMaxListeners%28%29%20to%20increase%20limit.%22%2Cthis._events%5Be%5D.length%29%2C%22function%22%3D%3Dtypeof%20console.trace%26%26console.trace%28%29%29%2Cthis%7D%2Cr.prototype.on%3Dr.prototype.addListener%2Cr.prototype.once%3Dfunction%28e%2Ct%29%7Bfunction%20a%28%29%7Bthis.removeListener%28e%2Ca%29%2Cr%7C%7C%28r%3D%210%2Ct.apply%28this%2Carguments%29%29%7Dif%28%21i%28t%29%29throw%20TypeError%28%22listener%20must%20be%20a%20function%22%29%3Bvar%20r%3D%211%3Breturn%20a.listener%3Dt%2Cthis.on%28e%2Ca%29%2Cthis%7D%2Cr.prototype.removeListener%3Dfunction%28e%2Ct%29%7Bvar%20a%2Cr%2Cs%2Co%3Bif%28%21i%28t%29%29throw%20TypeError%28%22listener%20must%20be%20a%20function%22%29%3Bif%28%21this._events%7C%7C%21this._events%5Be%5D%29return%20this%3Bif%28a%3Dthis._events%5Be%5D%2Cs%3Da.length%2Cr%3D-1%2Ca%3D%3D%3Dt%7C%7Ci%28a.listener%29%26%26a.listener%3D%3D%3Dt%29delete%20this._events%5Be%5D%2Cthis._events.removeListener%26%26this.emit%28%22removeListener%22%2Ce%2Ct%29%3Belse%20if%28n%28a%29%29%7Bfor%28o%3Ds%3Bo--%20%3E0%3B%29if%28a%5Bo%5D%3D%3D%3Dt%7C%7Ca%5Bo%5D.listener%26%26a%5Bo%5D.listener%3D%3D%3Dt%29%7Br%3Do%3Bbreak%7Dif%28r%3C0%29return%20this%3B1%3D%3D%3Da.length%3F%28a.length%3D0%2Cdelete%20this._events%5Be%5D%29%3Aa.splice%28r%2C1%29%2Cthis._events.removeListener%26%26this.emit%28%22removeListener%22%2Ce%2Ct%29%7Dreturn%20this%7D%2Cr.prototype.removeAllListeners%3Dfunction%28e%29%7Bvar%20t%2Ca%3Bif%28%21this._events%29return%20this%3Bif%28%21this._events.removeListener%29return%200%3D%3D%3Darguments.length%3Fthis._events%3D%7B%7D%3Athis._events%5Be%5D%26%26dLine truncated
</script>
</body> </body>
</html> </html>