]> git.pond.sub.org Git - eow/blobdiff - static/eow.js
remove key event logging (bogs down performance)
[eow] / static / eow.js
index 55fb20c134b5db38691cbeaaf3d57ee7d4113724..462e4657aa6cd8f106edb66f994c7b3cac6e2397 100644 (file)
@@ -34,7 +34,53 @@ function get_next_update() {
   });
 }
 
+function submit_cmdline(cmdline_form) {
+  dojo.xhrGet( {
+    // The following URL must match that used to test the server.
+    url: "/eow/command", 
+    handleAs: "text",
+
+    timeout: 30000, // Time in milliseconds
+
+    // The LOAD function will be called on a successful response.
+    load: function(response, ioArgs) {
+       console.log(response);
+       return response;
+      },
+
+    // The ERROR function will be called in an error case.
+    error: function(response, ioArgs) {
+       if (response.dojoType == "timeout") {
+         ioArgs.xhr.abort();
+         return response;
+       }
+
+       console.error("HTTP status code: ", ioArgs.xhr.status);
+       return response;
+      },
+
+    form: cmdline_form
+  });
+}
+
 function prompt(minutes, btus) {
   eowOut("[" + minutes + "," + btus + "]: ");
   get_next_update();
 }
+
+function msg(m) {
+  eowOut(m);
+  get_next_update();
+}
+
+function setup_client() {
+  var input = dojo.byId("inputfield");
+  input.focus();
+}
+
+function inputfield_keyup(e) {
+  if (e.keyCode == 13) { // Enter
+    submit_cmdline(e.target.form.id);
+    e.target.value = "";
+  }
+}