X-Git-Url: http://git.pond.sub.org/?p=eow;a=blobdiff_plain;f=static%2Feow.js;h=bdad450a2fb2fb98240e8fd0334c11970880c4ef;hp=b3f27ed5cd6d32414ad3c460635ba66401c1d218;hb=refs%2Fheads%2Fxdump-nopack;hpb=7beca26e6ea91745cd397ad69ac6e26bb934e683 diff --git a/static/eow.js b/static/eow.js index b3f27ed..bdad450 100644 --- a/static/eow.js +++ b/static/eow.js @@ -11,14 +11,25 @@ function setup() { function eowOut(output) { $("#output").append("
" + output + "
"); - window.scrollTo(0, window.scrollMaxY); + $("input")[0].scrollIntoView(false); } function get_next_update() { - $.getScript("/eow/update", function(data, textStatus) { - console.log(textStatus); - return data; - }); + $.ajax({ + url: "/eow/update", + dataType: "script", + success: function(data, textStatus) { + console.log(textStatus + " " + data); + }, + error: function(xhr, textStatus, error) { + if (textStatus == "timeout") { + xhr.abort(); + next(); + } + + console.error("HTTP status code: ", xhr.status); + } + }); } function submit_cmdline(command) { @@ -69,7 +80,7 @@ function inputfield_keyup(e) { if (e.keyCode == 13) { // Enter eowOut($("#prompt").text() + e.target.value); submit_cmdline(e.target.value); - window.scrollTo(0, window.scrollMaxY); + $("#inputfield").focus(); e.target.value = ""; } }