-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
85 lines (73 loc) · 3.19 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="language" content="EN" />
<meta name="keywords"
content="elapsed, obs, timer, countup, count, kai, kai cenat, elden ring, sunny, feelssunnyman, stream, streamer, chat, overlay, udner cam, white, count, countup " />
<meta name="description" content="An elapse time counter for OBS" />
<meta name="subject" content="Elapse Time" />
<meta name="copyright" content="RingoMar" />
<meta name="url" content="ringomar.github.io/timer" />
<meta data-rh="true" name="twitter:card" content="summary_large_image">
<meta data-rh="true" property="og:image"
content="https://ringomar.github.io/TheTimekeeper/img/docusaurus-social-card.jpg">
<meta data-rh="true" name="twitter:image"
content="https://ringomar.github.io/TheTimekeeper/img/docusaurus-social-card.jpg">
<meta data-rh="true" property="og:url" content="https://ringomar.github.io/timer">
<meta data-rh="true" property="og:locale" content="en">
<meta name="rating" content="General" />
<meta name="author" content="ringomar, github.com/ringomar" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>Elapsed Timer</title>
<link rel="stylesheet" href="style.css">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-0GS2KLZXCG"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-0GS2KLZXCG");
</script>
</head>
<body>
<div class="container">
<div class="hours_time num">00</div>
<div class="min_time num">00</div>
<div class="sec_time num">00</div>
<div class="hours telem">HOURS</div>
<div class="min telem">MINUTES</div>
<div class="sec telem">SECONDS</div>
</div>
<script>
const h = document.querySelector(".hours_time");
const m = document.querySelector(".min_time");
const s = document.querySelector(".sec_time");
function pad(num) {
if (num === -1) {
return "00";
} else {
return (num < 10 ? "0" : "") + Math.round(num);
}
}
const timestampParam = new URLSearchParams(window.location.search).get("time");
var startTimeUnix = timestampParam
? Date.parse(timestampParam) / 1000
: Date.parse(new Date().toISOString()) / 1000;
function updateTimer() {
var currentTime = Math.floor(Date.now() / 1000);
var elapsedTime = currentTime - startTimeUnix;
var hours = Math.floor(elapsedTime / 3600);
var minutes = Math.floor((elapsedTime % 3600) / 60);
var seconds = elapsedTime % 60;
h.textContent = pad(hours);
m.textContent = pad(minutes);
s.textContent = pad(seconds);
}
updateTimer();
setInterval(updateTimer, 100);
</script>
</body>
</html>