2014-08-04 19:41:30 +00:00
|
|
|
function load() {
|
|
|
|
var base = 'http://[::1]:9842',
|
|
|
|
img = new Image();
|
|
|
|
img.onload = function(event) {
|
|
|
|
document.location.href = base;
|
|
|
|
};
|
|
|
|
img.src = base + '/static/oxjs/build/Ox.UI/png/transparent.png?' + new Date;
|
|
|
|
};
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.onload = function() {
|
|
|
|
var response = JSON.parse(this.responseText);
|
2014-08-07 09:49:59 +00:00
|
|
|
if (response.step) {
|
|
|
|
var status = response.step;
|
2014-08-04 19:41:30 +00:00
|
|
|
if (response.progress) {
|
|
|
|
status = parseInt(response.progress * 100) + '% ' + status;
|
|
|
|
}
|
|
|
|
document.getElementById('status').innerHTML = status;
|
|
|
|
setTimeout(update, 1000);
|
|
|
|
} else {
|
|
|
|
document.getElementById('status').innerHTML = "done";
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhr.onerror = function() {
|
|
|
|
var status = document.getElementById('status').innerHTML;
|
|
|
|
if (['done', 'setup'].indexOf(status) == -1) {
|
|
|
|
document.getElementById('status').innerHTML = "error";
|
|
|
|
}
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
xhr.open('get', '/status');
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
update();
|