-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.html
53 lines (46 loc) · 1.4 KB
/
clock.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>A simple clock</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.27/moment-timezone-with-data.min.js'></script>
<style>
.clock {
font: bold 16px consolas;
color:white;
display: inline-block;
border-radius: 5px;
padding: 2px 5px;
background-colour: rgba(0,0,0,0,5);
}
</style>
</head>
<body translate="no" >
<div class="clock">
<p>AXON BODY 2 - SASP Trooper 208</p>
<p id="output"></p>
</div>
<script>
// https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
var urlParams;
(function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
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");
var c;
setInterval(
c = function() {
output.innerText = moment().tz('America/New_York').format(urlParams["format"] || '');
}, 1000);
c();
</script>
</body>
</html>