-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstats.htmlx
81 lines (68 loc) · 2.75 KB
/
stats.htmlx
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading...</title>
<script src="/assets/js/kitsunecore.min.js"></script>
<script>
const eDate = new Date(1695134779505); // new Date('2023-09-18T11:20:00.000-06:00'); appt // new Date('2023-09-14T16:40:00.000-06:00'); moved
const eTimeState = JSX.createState();
const eFormattedTimeState = eTimeState.format(function(ms) {
const sign = -ms<0 ? '-' : '+';
ms = Math.abs(ms);
const yy = Math.floor(ms / 1000 / 60 / 60 / 24 / 365);
ms -= yy * 1000 * 60 * 60 * 24 * 365;
const dd = Math.floor(ms / 1000 / 60 / 60 / 24);
ms -= dd * 1000 * 60 * 60 * 24;
const hh = Math.floor(ms / 1000 / 60 / 60);
ms -= hh * 1000 * 60 * 60;
const mm = Math.floor(ms / 1000 / 60);
ms -= mm * 1000 * 60;
const ss = Math.floor(ms / 1000);
ms -= ss * 1000;
const p2 = n => n.toString().padStart(2,'0');
return `E${sign}${yy > 0 ? `${yy}y `: ''}${yy > 0 || dd > 0 ? `${dd}d ` : ''}${hh}:${p2(mm)}:${p2(ss)}.${(Math.abs(ms)%1000).toString().padStart(3,'0')}`;
});
eFormattedTimeState.connectCallback(s => document.title = `⚧️ ${s}`);
setInterval((function refresh() {
eTimeState.set(eDate - Date.now());
return refresh;
})(), 75);
</script>
<style %{LESS}>
html, body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
height: 100%;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
color: #333;
span {
font-size: large;
padding: 1em;
border-radius: 2em;
color: #fff;
background-color: #b00b69;
font-weight: bold;
user-select: none;
}
h1 {
font-size: 5em;
margin: 0;
margin-bottom: 1rem;
}
}
</style>
</head>
<body>
<h1>⚧️</h1>
<script %{TS}>
$ctx = <span>{eFormattedTimeState}</span>
</script>
</body>
</html>