-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathClock-01.html
81 lines (42 loc) · 1.82 KB
/
Clock-01.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
<html>
<head>
<title>A Simple Clock</title>
<meta charset="utf-8" lang="zh-Hans" />
<meta name="application-name" content="A Simple Clock" />
<meta name="description" content="a simple (browser source) clock." />
<meta name="author" content="鸾瑶綾舞 [灵感来自:IAmSeraph]" />
<meta name="keywords" content="Clock (OBS Browser Source)" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 暂时没搞懂用途+这玩意国内访问不太正常 先暂时注释掉
<link href="https://pagecdn.io/lib/easyfonts/fonts.css" rel="stylesheet" />
-->
<script src="https://luanyaolingwu.github.io/moment-with-locales.min.js"></script>
</head>
<body translate="no">
<div id="clock"></div>
<script type="application/javascript">
const defaultFormat = "LTS ll";
var urlParams;
(function () {
var matcher,
pattern = /\+/g,
search = /([^&=]+)=?([^&]*)/g,
decode = function (str) { return decodeURIComponent(str.replace(pattern, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (matcher = search.exec(query))
urlParams[decode(matcher[1])] = decode(matcher[2]);
})();
var clockOutput = document.getElementById("clock");
if (urlParams["style"]) clockOutput.setAttribute("style", urlParams["style"]);
if (urlParams["bodyStyle"]) document.body.setAttribute("style", urlParams["bodyStyle"]);
if (urlParams["locale"]) moment.locale(urlParams["locale"]);
var runClock;
setInterval(
runClock = function() {
clockOutput.innerText = moment().format(urlParams["format"] || defaultFormat);
}, 1000);
runClock();
</script>
</body>
</html>