-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
53 lines (46 loc) · 1.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stats</title>
<style type="text/css">
#progress {
background-color: black;
color: white;
white-space: pre-wrap;
overflow-wrap: anywhere;
font-family: monospace;
width: 100%;
height: 70vh;
overflow-y: auto;
}
</style>
</head>
<body>
<h1>Basic Stats</h1>
<div id="progress"></div>
<script type="text/javascript">
const interval = 1000;
const progress = document.getElementById('progress');
let timeout;
function updateProgress() {
fetch('/progress.txt')
.then(response => response.text())
.then(text => progress.textContent = text)
.then(() => {
// scroll to bottom of #progress
progress.scrollTop = progress.scrollHeight;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(updateProgress, interval);
})
.catch(error => {
console.error(error);
if (timeout) clearTimeout(timeout);
timeout = setTimeout(updateProgress, interval);
});
}
updateProgress();
</script>
</body>
</html>