fix js issues

pull/30/head
Thorsten von Eicken 10 years ago
parent 076b0ff754
commit 2ff7e703ce
  1. 5
      html/console.html
  2. 6
      html/console.js

@ -27,9 +27,10 @@
$("#reset-button").addEventListener("click", function(e) { $("#reset-button").addEventListener("click", function(e) {
e.preventDefault(); e.preventDefault();
$("#console").innerHTML = ""; var co = $("#console");
co.innerHTML = "";
ajaxSpin('POST', "/console/reset", ajaxSpin('POST', "/console/reset",
function(resp) { showNotification("uC reset"); }, function(resp) { showNotification("uC reset"); co.textEnd = 0; },
function(s, st) { showWarning("Error resetting uC"); } function(s, st) { showWarning("Error resetting uC"); }
); );
}); });

@ -1,5 +1,5 @@
function fetchText(delay, repeat) { function fetchText(delay, repeat) {
el = $("#console"); var el = $("#console");
if (el.textEnd == undefined) { if (el.textEnd == undefined) {
el.textEnd = 0; el.textEnd = 0;
el.innerHTML = ""; el.innerHTML = "";
@ -15,9 +15,9 @@ function fetchText(delay, repeat) {
} }
function updateText(resp) { function updateText(resp) {
el = $("#console"); var el = $("#console");
delay = 3000; var delay = 3000;
if (resp != null && resp.len > 0) { if (resp != null && resp.len > 0) {
console.log("updateText got", resp.len, "chars at", resp.start); console.log("updateText got", resp.len, "chars at", resp.start);
if (resp.start > el.textEnd) { if (resp.start > el.textEnd) {

Loading…
Cancel
Save