-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
77 lines (57 loc) · 2.27 KB
/
index.html
File metadata and controls
77 lines (57 loc) · 2.27 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<head>
</head>
<body>
<script>
const startTimeMs = 1641067200000;
function formatDuration(durationMs) {
if (durationMs < 0) return '';
const hours = Math.floor(durationMs / 1000 / 60 / 60);
const minutes = Math.floor((durationMs - hours * 60 * 60 * 1000) / 1000 / 60);
const seconds = Math.floor((durationMs - hours * 60 * 60 * 1000 - minutes * 60 * 1000) / 1000);
return (
timestampSection(hours) + ':' + timestampSection(minutes) + ':' + timestampSection(seconds)
);
}
function timestampSection(value) {
return value.toString().padStart(2, '0');
}
function getStrTimeUntilRoundStarts() {
const timeUntilEnd = startTimeMs - new Date().getTime();
if (timeUntilEnd <= 0) return "00:00";
else return formatDuration(timeUntilEnd);
}
document.body.style.backgroundColor = "#000";
document.body.style.color = "#FFF";
document.body.style.textAlign = "center";
document.body.append(document.createElement("br"));
document.body.append(document.createElement("br"));
document.body.append(document.createElement("br"));
document.body.append(document.createElement("br"));
let divRoundStartsIn = document.createElement("div");
divRoundStartsIn.style.fontSize = "60px";
divRoundStartsIn.innerHTML = "Round starts in";
document.body.append(divRoundStartsIn);
document.body.append(document.createElement("br"));
let divCountdown = document.createElement("div");
divCountdown.style.fontSize = "100px";
divCountdown.innerHTML = getStrTimeUntilRoundStarts();
document.body.append(divCountdown);
document.body.append(document.createElement("br"));
let divTimestamp = document.createElement("div");
divTimestamp.style.fontSize = "30px";
divTimestamp.innerHTML = new Date(startTimeMs).toString();
document.body.append(divTimestamp);
document.body.append(document.createElement("br"));
document.body.append(document.createElement("br"));
document.body.append(document.createElement("br"));
let divGameUrl = document.createElement("div");
divGameUrl.style.fontSize = "30px";
divGameUrl.innerHTML = 'Play the game at <a style="color:#4FA;" href="https://game.dfdao.xyz/">game.dfdao.xyz</a>';
document.body.append(divGameUrl);
setInterval(()=>{
divCountdown.innerHTML = getStrTimeUntilRoundStarts();
}, 1000);
</script>
</body>
</html>