travis-web/play/log.html

44 lines
940 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
var url = '/log'
var xhr, poll;
var length = 0;
function append(chunk) {
document.body.innerHTML = document.body.innerHTML + chunk;
}
function handleResponse() {
if (xhr.readyState != 4 && xhr.readyState != 3)
return;
if (xhr.readyState == 3 && xhr.status != 200)
return;
if (xhr.readyState == 4 && xhr.status != 200) {
clearInterval(poll);
}
log = xhr.responseText
chunk = log.slice(length)
length = log.length
append(chunk)
if (xhr.readyState == 4)
clearInterval(poll);
}
xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.onreadystatechange = handleResponse;
xhr.send(null);
poll = setInterval(handleResponse, 1);
</script>
</head>
<body></body>
</html>