1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 " />
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7
+ < meta name ="language " content ="EN " />
8
+ < meta name ="keywords "
9
+ content ="elapsed, obs, timer, countup, count, kai, kai cenat, elden ring, sunny, feelssunnyman, stream, streamer, chat, overlay, udner cam, white, count, countup " />
10
+ < meta name ="description " content ="An elapse time counter for OBS " />
11
+ < meta name ="subject " content ="Elapse Time " />
12
+ < meta name ="copyright " content ="RingoMar " />
13
+ < meta name ="url " content ="ringomar.github.io/timer " />
14
+ < meta data-rh ="true " name ="twitter:card " content ="summary_large_image " />
15
+ < meta data-rh ="true " property ="og:image "
16
+ content ="https://ringomar.github.io/TheTimekeeper/img/docusaurus-social-card.jpg " />
17
+ < meta data-rh ="true " name ="twitter:image "
18
+ content ="https://ringomar.github.io/TheTimekeeper/img/docusaurus-social-card.jpg " />
19
+ < meta data-rh ="true " property ="og:url " content ="https://ringomar.github.io/timer " />
20
+ < meta data-rh ="true " property ="og:locale " content ="en " />
21
+ < meta name ="rating " content ="General " />
22
+ < meta name ="author " content ="ringomar, github.com/ringomar " />
23
+ < link rel ="shortcut icon " href ="../favicon.ico " type ="image/x-icon " />
24
+ < title > Elapsed Timer - Nightly</ title >
25
+ < link rel ="stylesheet " href ="./nightly.css " />
26
+
27
+ < script async src ="https://www.googletagmanager.com/gtag/js?id=G-0GS2KLZXCG "> </ script >
28
+ < script >
29
+ window . dataLayer = window . dataLayer || [ ] ;
30
+ function gtag ( ) {
31
+ dataLayer . push ( arguments ) ;
32
+ }
33
+ gtag ( "js" , new Date ( ) ) ;
34
+
35
+ gtag ( "config" , "G-0GS2KLZXCG" ) ;
36
+ </ script >
37
+ </ head >
38
+
39
+ < body >
40
+ < div class ="container ">
41
+ < div class ="hours_time num "> 00</ div >
42
+ < div class ="min_time num "> 00</ div >
43
+ < div class ="sec_time num "> 00</ div >
44
+ < div class ="hours telem "> HOURS</ div >
45
+ < div class ="min telem "> MINUTES</ div >
46
+ < div class ="sec telem "> SECONDS</ div >
47
+ </ div >
48
+
49
+ < script src ="./urlMods.js "> </ script >
50
+
51
+ < script src ="./modifactions.js "> </ script >
52
+
53
+ < script >
54
+ const h = document . querySelector ( ".hours_time" ) ;
55
+ const m = document . querySelector ( ".min_time" ) ;
56
+ const s = document . querySelector ( ".sec_time" ) ;
57
+ function pad ( num ) {
58
+ if ( num === - 1 ) {
59
+ return "00" ;
60
+ } else {
61
+ return ( num < 10 ? "0" : "" ) + Math . round ( num ) ;
62
+ }
63
+ }
64
+
65
+ let timestampParam = new URLSearchParams ( window . location . search ) ;
66
+ const stopParam = new URLSearchParams ( window . location . search ) . get ( "stop" ) ;
67
+
68
+ if ( ! timestampParam . has ( "time" ) ) {
69
+ window . location . search = `${ window . location . search
70
+ } ?time=${ new Date ( ) . toISOString ( ) } `;
71
+ }
72
+
73
+ timestampParam = timestampParam . get ( "time" ) ;
74
+
75
+ var startTimeUnix = timestampParam
76
+ ? Date . parse ( timestampParam ) / 1000
77
+ : Date . parse ( new Date ( ) . toISOString ( ) ) / 1000 ;
78
+
79
+ function updateTimer ( ) {
80
+ let currentTime ;
81
+
82
+ if ( stopParam ) {
83
+ const parsedTime = Date . parse ( stopParam ) ;
84
+ if ( ! isNaN ( parsedTime ) ) {
85
+ currentTime = parsedTime / 1000 ; // Convert milliseconds to seconds
86
+ } else {
87
+ console . error ( "Invalid date format for stopParam:" , stopParam ) ;
88
+ currentTime = Math . floor ( Date . now ( ) / 1000 ) ; // Fallback to current time
89
+ }
90
+ } else {
91
+ currentTime = Math . floor ( Date . now ( ) / 1000 ) ; // Fallback to current time
92
+ }
93
+
94
+ // Calculate elapsed time
95
+ var elapsedTime = currentTime - startTimeUnix ;
96
+
97
+ var hours = Math . floor ( elapsedTime / 3600 ) ;
98
+ var minutes = Math . floor ( ( elapsedTime % 3600 ) / 60 ) ;
99
+ var seconds = elapsedTime % 60 ;
100
+
101
+ h . textContent = pad ( hours ) ;
102
+ m . textContent = pad ( minutes ) ;
103
+ s . textContent = pad ( seconds ) ;
104
+ }
105
+
106
+ updateTimer ( ) ;
107
+
108
+ setInterval ( updateTimer , 1000 ) ;
109
+ </ script >
110
+ </ body >
111
+
112
+ </ html >
0 commit comments