diff options
author | Chouser <chouser@n01se.net> | 2008-10-21 04:44:44 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2008-10-21 04:44:44 +0000 |
commit | 99000024fbb67ecdf9b45991840e0cd25a63d8f7 (patch) | |
tree | 1cb70422d2b387145812d1d8a5ae5e629fa1d223 /clojurescript/repl.html | |
parent | 94ca536b4e901c9ee0bc7bcc2662e86a7803fbbf (diff) |
ClojureScript: remove set-prop in favor of (set! prop val), plus some bug fixes.
Diffstat (limited to 'clojurescript/repl.html')
-rw-r--r-- | clojurescript/repl.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/clojurescript/repl.html b/clojurescript/repl.html new file mode 100644 index 00000000..2c179501 --- /dev/null +++ b/clojurescript/repl.html @@ -0,0 +1,65 @@ +<html> + <body> + <textarea rows="24" cols="80" id="ta"></textarea><br /> + <span style="font-family: monospace">user=></span> + <textarea id="text" rows="6" cols="80" + style="vertical-align: top"></textarea> + <div id="status"></div> + <!-- + <form onsubmit="jsrepl.runtest(); return false"> + <select id="t"> + <option>t01.js</option> + <option>t02.js</option> + <option>t03.js</option> + <option>t04.js</option> + <option>t05.js</option> + <option>t06.js</option> + </select> + <input type="submit" value="Run test" /> + </form> + --> + <script type="text/javascript"> + jsrepl = { + ta: document.getElementById( 'ta' ), + t: document.getElementById( 't' ), + text: document.getElementById( 'text' ), + status: document.getElementById( 'status' ), + runtest: function() { + var s = document.createElement('script'); + s.src = jsrepl.t.value; + document.body.appendChild( s ); + }, + posttext: function() { + var text = jsrepl.text.value.replace(/\n$/,""); + print( "user=> " + text.replace(/\n/g,"\n ")); + jsrepl.text.value = ""; + }, + state: function(s,m) { + jsrepl.status.innerHTML = s; + switch( s ) { + case 'error': + jsrepl.posttext(); + print( m ); + break; + case 'compiled': + jsrepl.posttext(); + break; + } + jsrepl.ta.scrollTop = jsrepl.ta.scrollHeight; + } + }; + jsrepl.text.onkeypress = function(e) { + e = e || event; + if( e.keyCode == 13 ) { + var s = document.createElement('script'); + s.src = "http://localhost:8081/" + + escape(jsrepl.text.value).replace(/\+/,'%2b'); + document.body.appendChild( s ); + } + }; + function print( x ) { jsrepl.ta.value += x + "\n"; } + </script> + <script type="text/javascript" src="clj.js"></script> + <script type="text/javascript" src="boot.js"></script> + </body> +</html> |