X-Git-Url: http://git.pond.sub.org/?p=eow;a=blobdiff_plain;f=static%2Feow.js;h=19807e408f2a920c9390ee310b130455c26d9be2;hp=31a21f2fe3b8adf39a977251187314c679b7f65b;hb=761774603f988ef58b11ab22c5bbf862819f9cef;hpb=f08c83a6016dddd28fd4acc9bb12c4350a40c004 diff --git a/static/eow.js b/static/eow.js index 31a21f2..19807e4 100644 --- a/static/eow.js +++ b/static/eow.js @@ -1,10 +1,19 @@ +function byId(id) { + return document.getElementById(id); +} + function eowOut(output) { var t = document.createTextNode(output); - var p = document.createElement("p"); + var p = document.createElement("pre"); p.appendChild(t); - dojo.byId("output").appendChild(p); + byId("output").appendChild(p); + window.scrollTo(0, window.scrollMaxY); } +//t = window.setTimeout(f, 10000); +//window.clearTimeout(t) +//e = document.getElementById(id) + function get_next_update() { dojo.xhrGet( { // The following URL must match that used to test the server. @@ -63,8 +72,8 @@ function submit_cmdline(cmdline_form) { }); } -function prompt(minutes, btus) { - eowOut("[" + minutes + "," + btus + "]: "); +function prompt(p) { + byId("prompt").textContent = p; get_next_update(); } @@ -74,14 +83,15 @@ function msg(m) { } function setup_client() { - var input = dojo.byId("inputfield"); + var input = byId("inputfield"); input.focus(); } function inputfield_keyup(e) { - console.log(e); if (e.keyCode == 13) { // Enter + eowOut(byId("prompt").textContent + e.target.value); submit_cmdline(e.target.form.id); + window.scrollTo(0, window.scrollMaxY); e.target.value = ""; } }