-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.html
More file actions
61 lines (56 loc) · 1.72 KB
/
clock.html
File metadata and controls
61 lines (56 loc) · 1.72 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>A simple clock</title>
<style>
@font-face {
font-family: 'MyFont';
src: url('./GaretHeavy.ttf') format('truetype');
/*src: url('./IntroRust-Base.ttf') format('opentype');*/
}
#output {
display: flex;
justify-content: center; /* Horizontal centering */
align-items: center; /* Vertical centering */
font-family: 'MyFont', monospace;
font-size: 120px;
text-align: right;
color: white;
width: 750px; /* Rectangle width 600 for non pm, 750 for pm*/
height: 160px; /* Rectangle height */
border-radius: 30px;
padding: 10px;
/* background-color: rgba(151, 145, 255, 1);*/
box-sizing: border-box;
text-align: center;
}
</style>
</head>
<body translate="no">
<div id="output"></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script>
<script>
var urlParams;
(function () {
var match,
pl = /\+/g,
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
})();
var output = document.getElementById("output");
if (urlParams["style"]) output.setAttribute("style", urlParams["style"]);
if (urlParams["bodyStyle"]) document.body.setAttribute("style", urlParams["bodyStyle"]);
var c;
setInterval(
c = function () {
output.innerText = moment().format(urlParams["format"] || 'hh:mm:ssA');
}, 1000);
c();
</script>
</body>
</html>