From: Gerd Flaig Date: Sun, 21 Dec 2008 14:29:07 +0000 (+0100) Subject: Write command to terminal output. Scroll to bottom on new output. X-Git-Url: http://git.pond.sub.org/?p=eow;a=commitdiff_plain;h=6b9c566dbd2ad6010cc3805c163eea5320c56f38 Write command to terminal output. Scroll to bottom on new output. --- diff --git a/static/eow.js b/static/eow.js index 462e465..a0defc9 100644 --- a/static/eow.js +++ b/static/eow.js @@ -1,10 +1,15 @@ 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); + 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. @@ -64,7 +69,7 @@ function submit_cmdline(cmdline_form) { } function prompt(minutes, btus) { - eowOut("[" + minutes + "," + btus + "]: "); + dojo.byId("prompt").textContent = "[" + minutes + "," + btus + "]: "; get_next_update(); } @@ -80,7 +85,9 @@ function setup_client() { function inputfield_keyup(e) { if (e.keyCode == 13) { // Enter + eowOut(dojo.byId("prompt").textContent + e.target.value); submit_cmdline(e.target.form.id); + window.scrollTo(0, window.scrollMaxY); e.target.value = ""; } }