-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordclock.html
396 lines (363 loc) · 17.6 KB
/
wordclock.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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<!DOCTYPE html>
<html lang="en" draggable="false">
<head>
<link rel="icon" href="wordclock.png" type="image/x-icon">
<meta charset="UTF-8">
<meta name="description"
content="word clock is a tiny little extension for safari, chrome, edge, and opera. tell the time with a click.">
<meta name="keywords"
content="word clock, extension, fun%20extension, word%20clock, character%20clock, character clock, safari, chrome, firefox, edge, brave">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>word clock | Teenage Tech</title>
<link rel="stylesheet" href="styles.css">
<style>
body {
background-color: #171717;
color: #FFFFFF;
}
.btn {
display: flex;
flex-direction: column;
align-items: center;
}
.dload {
background-color: #e0e0e0;
color: #77a6b4;
border-radius: 10px;
padding: 10px;
text-decoration: none;
display: inline-flex;
align-items: center;
font-size: 16px;
margin: 5px 0;
margin-bottom: 15px;
transition: background-color 0.3s, opacity 1s ease-out, transform 0.7s ease-out;
opacity: 0;
transform: translateY(20px);
}
.dload.show {
opacity: 1;
transform: translateY(0);
}
.dload:hover {
background-color: #df6d6d;
color: #e0e0e0;
}
.dload img.icon {
height: 40px;
margin-right: 10px;
}
.screenshot {
width: 90%;
opacity: 0;
transform: translateY(20px);
transition: opacity 1s ease-out, transform 0.7s ease-out;
}
.screenshot.show {
opacity: 1;
transform: translateY(0);
}
main {
text-align: center;
}
.hidden {
display: none;
}
.show-more-btn {
background-color: #77a6b4;
color: #FFFFFF;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
margin: 20px 0;
}
#wordClock {
font-size: 24px;
font-weight: bold;
text-align: center;
line-height: 1.5;
color: #F3DE2C;
max-width: 400px;
display: inline-flex;
align-items: center;
background-color: #222222;
border-radius: 20px;
padding-left: 10px;
padding-right: 10px;
}
</style>
<meta name="theme-color" content="#77a4b6">
</head>
</head>
<body>
<div id="header-container"></div>
<main>
<div>
<img src="word clock.png" alt="" width="400" height="400">
<br>
<div id="wordClock"></div>
<br>
<br>
<br>
<h2>word clock is a tiny little extension for<br>safari, chrome, edge, opera, firefox, and brave.<br>tell
the time with a click.</h2>
<br>
<img src="safari screenshot.png" alt="word clock in safari" class="screenshot" id="safari1">
<img src="chrome screenshot.png" alt="word clock in chrome" class="screenshot" id="chrome1">
<img src="edge screenshot.png" alt="word clock in edge" class="screenshot" id="edge1">
<img src="opera screenshot.png" alt="word clock in opera" class="screenshot" id="opera1">
<img src="brave screenshot.png" alt="word clock in brave" class="screenshot" id="brave1">
<img src="firefox screenshot.png" alt="word clock in firefox" class="screenshot" id="firefox1">
<br><br><br>
<div class="btn">
<a href="word clock.app.zip" download class="dload" id="download-safari">
<img src="safari.png" alt="safari" class="icon">
<b>download word clock for safari (unstable)</b>
</a>
<a href="https://chromewebstore.google.com/detail/word-clock/epdjklohfglcjmnfgimekcpdjbjhapih" class="dload" id="download-webstore">
<img src="webstore.png" alt="chrome webstore" class="icon">
<b>get word clock on the chrome webstore</b>
</a>
<b id="option">(recommended)<br>or</b>
<div id="space" style="height: 40px;"></div>
<a href="word clock chrome.zip" download class="dload" id="download-chrome">
<img src="chrome.png" alt="chrome" class="icon">
<b>download word clock for chrome</b>
</a>
<a href="word clock edge.zip" download class="dload" id="download-edge">
<img src="edge.png" alt="edge" class="icon">
<b>download word clock for edge</b>
</a>
<a href="word clock opera.zip" download class="dload" id="download-opera">
<img src="opera.png" alt="opera" class="icon">
<b>download word clock for opera</b>
</a>
<a href="word clock brave.zip" download class="dload" id="download-brave">
<img src="brave.png" alt="brave" class="icon">
<b>download word clock for brave</b>
</a>
<a href="https://addons.mozilla.org/en-US/firefox/addon/word-clock/" class="dload" id="download-firefox">
<img src="firefox.png" alt="firefox" class="icon">
<b>get word clock for firefox<br>on the firefox add-ons store</b>
</a>
</div>
<br><br>
<button class="show-more-btn" onclick="showAllDownloads()">show other options</button>
<br><br><br>
<h2>to install word clock on macOS for safari:</h2>
<p>first, unzip the <b>word clock.app.zip</b> file by double clicking on it,
<br>then drag the <b>word clock.app</b> file you unzipped into your applications folder.<br>
<h3>if you're running macOS seqouia:</h3>
try to open the word clock app from the launchpad<br>
(you will be greeted by dialouge saying "Apple could not verify “word clock” is<br>
free of malware that may harm your Mac or compromise your privacy."<br>
however, this is normal, and isn't correct, but the new security features in<br>
macOS sequoia block it anyway.)<br>
then, open system settings ( > System Settings...), click on "privacy and security",<br>
(you should see the alert "word clock was blocked to protect your Mac")<br>
next to it, there's a button that says "Open Anyway".<br>
click on it, select "Open Anyway" again in the popup alert, enter your <br>
password (if prompted) to launch word clock and follow the steps<br>
in the app to install it as a safari extension.
<h3>if you're not running macOS sequoia:</h3>
next, control-click (right-click) on <b>word clock.app</b> and select "Open"
<br>(you can ignore the warning dialogue)<br>
<br>enter your passoword (if prompted) to launch word clock and follow the steps<br>
in the app to install it as a safari extension.
</p>
<h2>to install word clock on chrome, edge, opera, or brave:</h2>
<p>download the respective file for your browser and unzip it,<br>then open your extensions page on chrome,
edge, opera, or brave.
<br>(this is typically done by typing your browser name,<br>then <b>://extensions</b>, as in
<b>chrome://extensions</b>), or by opening<br>your browser's sidebar and selecting <b>extensions</b>
from the drop-down menu.
<br><b>enable developer mode</b> (temporarily) and drag and drop the<br>word clock folder into the
extensions page.<br>
(alternatively, you can click <b>load unpacked</b> and select the
<br>word clock folder instead.)
<br>
<br>you can safely disable developer mode once word clock is installed.<br>your browser might show an
alert, saying that it<br>"can't verify where this extension comes from",<br>but you can silence it by
clicking the three dots
<br>next to the alert and selecting <b>keep this extension</b>.<br><br>last but not least, turn word
clock on,<br>pin it to your browser's toolbar for the best experience, and tell the time with a click.
</p>
</div>
</main>
<footer>
<p>© Teenage Tech. All rights reserved.</p>
</footer>
<script src="header.js"></script>
<script>
function detectBrowser() {
var userAgent = navigator.userAgent.toLowerCase();
var safari = document.getElementById('download-safari');
var chrome = document.getElementById('download-chrome');
var edge = document.getElementById('download-edge');
var opera = document.getElementById('download-opera');
var brave = document.getElementById('download-brave');
var firefox = document.getElementById('download-firefox');
var safari1 = document.getElementById('safari1');
var chrome1 = document.getElementById('chrome1');
var edge1 = document.getElementById('edge1');
var opera1 = document.getElementById('opera1');
var brave1 = document.getElementById('brave1');
var firefox1 = document.getElementById('firefox1');
var webstore = document.getElementById('download-webstore');
var option = document.getElementById('option');
var space = document.getElementById('space');
safari.classList.add('hidden');
chrome.classList.add('hidden');
edge.classList.add('hidden');
opera.classList.add('hidden');
brave.classList.add('hidden');
firefox.classList.add('hidden');
safari1.classList.add('hidden');
chrome1.classList.add('hidden');
edge1.classList.add('hidden');
opera1.classList.add('hidden');
brave1.classList.add('hidden');
firefox1.classList.add('hidden');
webstore.classList.add('hidden');
option.classList.add('hidden');
space.classList.add('show');
var isOpera = (userAgent.includes('opera') || userAgent.includes('opr')) || (!!window.opr && !!opr.addons);
var isEdgeChromium = userAgent.includes('edg');
var isBrave = (navigator.brave && navigator.brave.isBrave) || userAgent.includes('brave');
var isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
var isChrome = userAgent.includes('chrome') && !isOpera && !isEdgeChromium && !isBrave;
var isFirefox = userAgent.includes('firefox') && !isOpera && !isEdgeChromium && !isBrave && !isChrome;
if (isSafari) {
safari.classList.remove('hidden');
safari1.classList.remove('hidden');
safari1.classList.add('show');
option.classList.add('hidden');
} else if (isChrome) {
chrome.classList.remove('hidden');
chrome1.classList.remove('hidden');
chrome1.classList.add('show');
webstore.classList.remove('hidden');
option.classList.remove('hidden');
option.classList.add('show');
} else if (isEdgeChromium) {
edge.classList.remove('hidden');
edge1.classList.remove('hidden');
edge1.classList.add('show');
webstore.classList.remove('hidden');
option.classList.remove('hidden');
option.classList.add('show');
} else if (isOpera) {
opera.classList.remove('hidden');
opera1.classList.remove('hidden');
opera1.classList.add('show');
webstore.classList.remove('hidden');
option.classList.remove('hidden');
option.classList.add('show');
} else if (isBrave) {
brave.classList.remove('hidden');
brave1.classList.remove('hidden');
brave1.classList.add('show');
webstore.classList.remove('hidden');
option.classList.remove('hidden');
option.classList.add('show');
} else if (isFirefox) {
firefox.classList.remove('hidden');
firefox1.classList.remove('hidden');
firefox1.classList.add('show');
option.classList.add('hidden');
webstore.classList.add('hidden');
}
else {
showAllDownloads()
safari1.classList.remove('hidden');
safari1.classList.add('show');
}
}
function showAllDownloads() {
var userAgent = navigator.userAgent.toLowerCase();
var isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
var isFirefox = userAgent.includes('firefox') && !isOpera && !isEdgeChromium && !isBrave && !isChrome;
var downloadButtons = document.querySelectorAll('.dload');
downloadButtons.forEach(button => {
button.classList.remove('hidden');
button.classList.add('show');
});
space.classList.remove('show')
space.classList.add('hidden')
option.classList.remove('show');
option.classList.add('hidden');
document.querySelector('.show-more-btn').style.display = 'none';
}
window.onload = function () {
detectBrowser();
var downloadButtons = document.querySelectorAll('.dload');
var options = {
threshold: 0.5
};
var observer = new IntersectionObserver(function (entries, observer) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
observer.unobserve(entry.target);
}
});
}, options);
downloadButtons.forEach(button => {
observer.observe(button);
});
};
</script>
<script>
function numberToWords(number) {
const words = [
'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten',
'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen',
'twenty', 'twenty-one', 'twenty-two', 'twenty-three', 'twenty-four', 'twenty-five', 'twenty-six',
'twenty-seven', 'twenty-eight', 'twenty-nine', 'thirty', 'thirty-one', 'thirty-two', 'thirty-three',
'thirty-four', 'thirty-five', 'thirty-six', 'thirty-seven', 'thirty-eight', 'thirty-nine',
'forty', 'forty-one', 'forty-two', 'forty-three', 'forty-four', 'forty-five', 'forty-six',
'forty-seven', 'forty-eight', 'forty-nine', 'fifty', 'fifty-one', 'fifty-two', 'fifty-three',
'fifty-four', 'fifty-five', 'fifty-six', 'fifty-seven', 'fifty-eight', 'fifty-nine'
];
return words[number];
}
function getOrdinalSuffix(number) {
if (number >= 1 && number <= 31) {
const suffixes = [
'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth',
'eleventh', 'twelfth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth',
'twentieth', 'twenty-first', 'twenty-second', 'twenty-third', 'twenty-fourth', 'twenty-fifth',
'twenty-sixth', 'twenty-seventh', 'twenty-eighth', 'twenty-ninth', 'thirtieth', 'thirty-first'
];
return suffixes[number - 1];
}
return numberToWords(number);
}
function getCurrentTimeInWords() {
const now = new Date();
let hour = now.getHours();
const minute = now.getMinutes();
const day = now.toLocaleString('default', { weekday: 'long' }).toLowerCase();
const month = now.toLocaleString('default', { month: 'long' }).toLowerCase();
const dayOfMonth = now.getDate();
const period = hour >= 12 ? 'PM' : 'AM';
hour = hour % 12 || 12;
const hourInWords = numberToWords(hour);
const minuteInWords = minute === 0 ? "o'clock" : minute < 10 ? `oh ${numberToWords(minute)}` : numberToWords(minute);
const dayOfMonthInWords = getOrdinalSuffix(dayOfMonth);
return `it's ${hourInWords} ${minuteInWords} on ${day}, ${month} ${dayOfMonthInWords}.`;
}
function updateClock() {
const clockElement = document.getElementById('wordClock');
clockElement.textContent = getCurrentTimeInWords();
}
document.addEventListener('DOMContentLoaded', () => {
updateClock();
setInterval(updateClock, 500);
});
</script>
<script type="module" src="firebaseconfig.js"></script>
</body>
</html>