This repository has been archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
91 lines (76 loc) · 2.09 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Does the CSSU have a microwave?</title>
<style>
#answer {
font-size: 6em;
font-weight: 700;
left: 50%;
margin: 0;
position: absolute;
text-align: center;
top: 50%;
transform: translate(-50%, -50%);
}
#since {
font-size: 0.15em;
margin: 0 auto;
text-align: center;
}
</style>
</head>
<body>
<div id="answer">
YES.
<p id="since"></p>
</div>
<script>
// TODO: update this on commit automatically
// Update when #answer changes
var LAST_UPDATE = 1483628415000; // Thu Jan 05 2017 10:00:15 GMT-0500 (EST)
var sinceEl = document.getElementById('since');
function getTimeSince(starttime) {
var t = +new Date - starttime; // Date.now() doesnt work before IE9
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
return {
'total': t,
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
};
}
function pluralize(s, v) {
if (v > 1) {
s += 's';
}
return s;
}
function updateTimer() {
var time = getTimeSince(LAST_UPDATE);
var countdownStr = '(updated ';
var days = time.days;
if (days > 0) {
countdownStr += days + ' ' + pluralize('day', days) + ', ';
}
var hours = time.hours;
if (hours > 0) {
countdownStr += hours + ' ' + pluralize('hour', hours) + ', ';
}
var minutes = time.minutes;
countdownStr += minutes + ' ' + pluralize('minute', minutes) + ' and ';
var seconds = time.seconds;
countdownStr += seconds + ' ' + pluralize('second', seconds);
countdownStr += ' ago)';
sinceEl.innerText = countdownStr;
}
// Smaller interval than 1s since people may open browser in between seconds
setInterval(updateTimer, 100);
</script>
</body>
</html>