-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.html
More file actions
153 lines (135 loc) · 4.32 KB
/
timer.html
File metadata and controls
153 lines (135 loc) · 4.32 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Timer | Tools and Utilities from SQA.MY">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="dark light">
<meta name="author" content="qwk">
<meta property="og:title" content="sqa.my/timer">
<meta property="og:description" content="Timer | Tools and Utilities from SQA.MY">
<meta property="og:type" content="website">
<meta property="og:site_name" content="sqa.my">
<meta property="og:locale" content="en_GB">
<meta property="og:image" content="https://og.tailgraph.com/og?fontFamily=Montserrat&title=Timer&titleTailwind=font-bold%20text-6xl%20text-white&text=Tools and Utilities from SQA.MY&textTailwind=text-2xl%20mt-4%20bg-blueGray-300%20text-gray-300&logoUrl=&logoTailwind=h-8&bgTailwind=bg-black&footer=sqa.my&footerTailwind=text-blue-400%20text-3xl&t=1744575448853&refresh=1">
<meta property="og:image:alt" content="sqa.my">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="sqa.my">
<meta name="twitter:site" content="@qwkdev">
<meta name="twitter:description" content="Timer | Tools and Utilities from SQA.MY">
<meta name="twitter:image" content="https://og.tailgraph.com/og?fontFamily=Montserrat&title=Timer&titleTailwind=font-bold%20text-6xl%20text-white&text=Tools and Utilities from SQA.MY&textTailwind=text-2xl%20mt-4%20bg-blueGray-300%20text-gray-300&logoUrl=&logoTailwind=h-8&bgTailwind=bg-black&footer=sqa.my&footerTailwind=text-blue-400%20text-3xl&t=1744575448853&refresh=1">
<meta name="twitter:image:alt" content="sqa.my">
<title>Timer | sqa.my/timer</title>
<style>
.underlined {
color: var(--ucolor, #fff);
font-weight: 500;
position: relative;
transition: .2s;
z-index: 2;
text-decoration: none;
}
.underline {
--widen: 0%;
--fix: 0%;
width: calc(100% + var(--widen));
transform: translateX(calc(-100% + var(--fix)));
height: 1px;
background: var(--ucolor, #fff);
position: absolute;
bottom: 0;
transition: .2s;
z-index: -1;
}
.underlined:hover {
color: var(--ubg, #000);
}
.underlined:hover .underline {
height: 100%;
}
.underlined::selection {
background: var(--ucolor2, #ffffff55);
}
#banner {
position: fixed;
top: 1vh;
left: 2vh;
font-family: monospace;
font-size: 2vh;
--ucolor: #777;
--ucolor2: #77777755;
--ubg: #000;
}
body {
margin: 0;
background: #000;
}
#clock {
--size: 20vw;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: var(--size);
color: #fff;
font-family: Arial, monospace;
text-align: center;
}
#clock::selection {
background: #fafaff77;
}
</style>
</head>
<body>
<div id="banner"><span><a class="underlined" href="/" aria-label="Home Page">sqa.my/timer<span class="underline" style="--widen: 2%; --fix: 1%;"></span></a></span></div>
<p id="clock"></p>
<script>
const path = window.location.search.slice(1);
let start = 0;
if (path) {
let parts = {};
let temp = '';
Array.from(path).forEach(c => {
if ('hms'.includes(c)) {
parts[c] = parseFloat(temp);
temp = '';
} else {
temp += c;
}
});
start = (parts.h ?? 0)*60*60 + (parts.m ?? 0)*60 + (parts.s ?? 0) + 1;
}
const pad = (n) => String(n).padStart(2, '0');
function updateTimer() {
let now = performance.now()/1000;
if (path) now = start - now;
if (now < 0) return;
const mins = now/60;
document.getElementById('clock').textContent = [mins/60, mins%60, now%60].map(Math.floor).map(pad).join(':');
}
updateTimer();
setInterval(updateTimer, 1000);
document.addEventListener('dblclick', () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
});
</script>
<script>
fetch('https://qtrack.pythonanywhere.com/visit/sqa-tools-timer', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
's': null,
'o': window.location.href || null,
'r': document.referrer || null
})
}).catch(error => console.error('Error fetching visits:', error));
</script>
</body>
</html>