cosmetic changes

This commit is contained in:
rlx 2016-01-12 08:29:28 +05:30
parent 704a93e2f1
commit eb648284a6

View file

@ -11,7 +11,7 @@ function load() {
ws.onclose = function(event) { ws.onclose = function(event) {
setTimeout(load, 500); setTimeout(load, 500);
}; };
}; }
function update() { function update() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
@ -25,20 +25,19 @@ function update() {
document.getElementById('status').innerHTML = status; document.getElementById('status').innerHTML = status;
setTimeout(update, 1000); setTimeout(update, 1000);
} else { } else {
document.getElementById('status').innerHTML = "done"; document.getElementById('status').innerHTML = 'done';
setTimeout(load, 500); setTimeout(load, 500);
} }
}; };
xhr.onerror = function() { xhr.onerror = function() {
var status = document.getElementById('status').innerHTML; var status = document.getElementById('status').innerHTML;
if (['done', 'setup'].indexOf(status) == -1) { if (['done', 'setup'].indexOf(status) == -1) {
document.getElementById('status').innerHTML = "error"; document.getElementById('status').innerHTML = 'error';
} }
load(); load();
} }
xhr.open('get', '/status'); xhr.open('get', '/status');
xhr.send(); xhr.send();
} }
update(); update();