|
|
@ -54,7 +54,7 @@ window.load = function load() { |
|
|
|
var delay = params.delay || 0; |
|
|
|
var delay = params.delay || 0; |
|
|
|
|
|
|
|
|
|
|
|
canvas = document.createElement('canvas'); |
|
|
|
canvas = document.createElement('canvas'); |
|
|
|
stdout = document.getElementById('stdout'); |
|
|
|
stdout = document.getElementById('output'); |
|
|
|
|
|
|
|
|
|
|
|
info('User Agent: ' + navigator.userAgent); |
|
|
|
info('User Agent: ' + navigator.userAgent); |
|
|
|
log('load...\n'); |
|
|
|
log('load...\n'); |
|
|
@ -93,7 +93,7 @@ function cleanup(callback) { |
|
|
|
var ownerNode = styleSheet.ownerNode; |
|
|
|
var ownerNode = styleSheet.ownerNode; |
|
|
|
ownerNode.parentNode.removeChild(ownerNode); |
|
|
|
ownerNode.parentNode.removeChild(ownerNode); |
|
|
|
} |
|
|
|
} |
|
|
|
var guard = document.getElementById('content-end'); |
|
|
|
var guard = document.getElementById('end'); |
|
|
|
var body = document.body; |
|
|
|
var body = document.body; |
|
|
|
while (body.lastChild !== guard) { |
|
|
|
while (body.lastChild !== guard) { |
|
|
|
body.removeChild(body.lastChild); |
|
|
|
body.removeChild(body.lastChild); |
|
|
@ -369,7 +369,7 @@ function quitApp() { |
|
|
|
|
|
|
|
|
|
|
|
function done() { |
|
|
|
function done() { |
|
|
|
if (inFlightRequests > 0) { |
|
|
|
if (inFlightRequests > 0) { |
|
|
|
document.getElementById('inFlightCount').innerHTML = inFlightRequests; |
|
|
|
document.getElementById('inflight').innerHTML = inFlightRequests; |
|
|
|
setTimeout(done, 100); |
|
|
|
setTimeout(done, 100); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setTimeout(quitApp, 100); |
|
|
|
setTimeout(quitApp, 100); |
|
|
@ -417,7 +417,7 @@ function send(url, message, callback) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
document.getElementById('inFlightCount').innerHTML = inFlightRequests++; |
|
|
|
document.getElementById('inflight').innerHTML = inFlightRequests++; |
|
|
|
r.send(message); |
|
|
|
r.send(message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -433,11 +433,8 @@ function clear(ctx) { |
|
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height); |
|
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Auto-scroll if the scrollbar is near the bottom, otherwise do nothing. */ |
|
|
|
function scroll() { |
|
|
|
function checkScrolling() { |
|
|
|
window.scrollTo(0, document.body.scrollHeight); |
|
|
|
if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) { |
|
|
|
|
|
|
|
stdout.scrollTop = stdout.scrollHeight; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function log(str) { |
|
|
|
function log(str) { |
|
|
@ -448,7 +445,7 @@ function log(str) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (str.lastIndexOf('\n') >= 0) { |
|
|
|
if (str.lastIndexOf('\n') >= 0) { |
|
|
|
checkScrolling(); |
|
|
|
scroll(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|