hy/demo/templates/popover.html
Paul Tagliamonte 4433592b5b foo
2012-12-26 23:08:09 -05:00

60 lines
1.1 KiB
HTML

<script type="text/javascript">
function reload() {
var input = $("#repl-input").val();
console.log("Input: " + input);
$('#repl-output').load(
'/translate',
{"code": input}
);
}
$(document).ready(function() {
$("#repl-input").keyup(function(e) {
reload();
});
reload();
$(document).keyup(function(e) {
if (e.keyCode == 27) {
$("#popshim").html("");
}
});
});
</script>
<div class = 'popover' >
<div class = 'focus' >
<div class = 'repl' >
<textarea id = 'repl-input' class = 'repl-left repl-pane' >
(import "os")
(print (os.path.abspath "."))
; something like /home/tag
(defn square [x]
(* x x))
(defn factorial (n)
(if (&lt;= n 1)
1
(* n (factorial (- n 1)))))
(defn fib (n)
(if (&lt; n 2)
n
(+ (fib (- n 1)) (fib (- n 2)))))
(print (fib 2))
; 1
(print "4! =" (factorial 4))
; 4! = 24
</textarea>
<pre id = 'repl-output' class = 'repl-right repl-pane' ></pre>
</div>
</div>
</div>