]> git.pond.sub.org Git - eow/commitdiff
Write command to terminal output. Scroll to bottom on new output.
authorGerd Flaig <gefla@gefla-mac-zrh>
Sun, 21 Dec 2008 14:29:07 +0000 (15:29 +0100)
committerGerd Flaig <gefla@gefla-mac-zrh>
Sun, 21 Dec 2008 14:29:07 +0000 (15:29 +0100)
static/eow.js

index 462e4657aa6cd8f106edb66f994c7b3cac6e2397..a0defc92b9fc76712ba573d994f697d06240f73e 100644 (file)
@@ -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 = "";
   }
 }