X-Git-Url: http://git.pond.sub.org/?p=eow;a=blobdiff_plain;f=static%2Feow.js;h=7dedd45a9ac0d7f52ea45f0273f6b76a5c92206f;hp=462e4657aa6cd8f106edb66f994c7b3cac6e2397;hb=a4f36e2bf190fa6f14347a00e309af5a3d74f159;hpb=f17995f251724c7edce2660fc1f8a10b1e368a11 diff --git a/static/eow.js b/static/eow.js index 462e465..7dedd45 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,24 +72,28 @@ function submit_cmdline(cmdline_form) { }); } -function prompt(minutes, btus) { - eowOut("[" + minutes + "," + btus + "]: "); - get_next_update(); +function prompt(p) { + byId("prompt").textContent = p; } function msg(m) { eowOut(m); +} + +function next() { get_next_update(); } function setup_client() { - var input = dojo.byId("inputfield"); + var input = byId("inputfield"); input.focus(); } function inputfield_keyup(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 = ""; } }