forked from letterly/letterly.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhmongclock.html
59 lines (58 loc) · 3.43 KB
/
hmongclock.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
<html>
<head>
<title>Hmong Clock</title>
<style>
text{
font-size: 24px;
}
p{
font-size: 80px;
text-align: center;
}
</style>
<script>
setInterval(function(){
center = 200
a = new Date();
second = a.getSeconds()
minute = a.getMinutes()
if(second < 10) second = "0" + second
if(minute < 10) minute = "0" + minute
hour = a.getHours() + (a.getMinutes() / 60)
thehour = (""+a.getHours()).replace(/0/g, "𞅀").replace(/1/g, "𞅁").replace(/2/g, "𞅂").replace(/3/g, "𞅃").replace(/4/g, "𞅄").replace(/5/g, "𞅅").replace(/6/g, "𞅆").replace(/7/g, "𞅇").replace(/8/g, "𞅈").replace(/9/g, "𞅉")
theminute = (""+minute).replace(/0/g, "𞅀").replace(/1/g, "𞅁").replace(/2/g, "𞅂").replace(/3/g, "𞅃").replace(/4/g, "𞅄").replace(/5/g, "𞅅").replace(/6/g, "𞅆").replace(/7/g, "𞅇").replace(/8/g, "𞅈").replace(/9/g, "𞅉")
thesecond = (""+second).replace(/0/g, "𞅀").replace(/1/g, "𞅁").replace(/2/g, "𞅂").replace(/3/g, "𞅃").replace(/4/g, "𞅄").replace(/5/g, "𞅅").replace(/6/g, "𞅆").replace(/7/g, "𞅇").replace(/8/g, "𞅈").replace(/9/g, "𞅉")
document.getElementById("thesecond").textContent = thesecond
document.getElementById("theminute").textContent = theminute
document.getElementById("thehour").textContent = thehour
document.getElementById("second").setAttribute("x2", center + (90 * Math.sin(second * Math.PI / 30)));
document.getElementById("second").setAttribute("y2", center - (90 * Math.cos(second * Math.PI / 30)));
document.getElementById("minute").setAttribute("x2", center + (80 * Math.sin(minute * Math.PI / 30)));
document.getElementById("minute").setAttribute("y2", center - (80 * Math.cos(minute * Math.PI / 30)));
document.getElementById("hour").setAttribute("x2", center + (70 * Math.sin((hour % 12) * Math.PI / 6)));
document.getElementById("hour").setAttribute("y2", center - (70 * Math.cos((hour % 12) * Math.PI / 6)));
}, 1000);
</script>
</head>
<body>
<svg width="400" height="400">
<circle cx="200" cy="200" r="100" fill="white" stroke="black"></circle>
<text x="192" y="92">𞅁𞅂</text>
<text x="251" y="111">𞅁</text>
<text x="290" y="150">𞅂</text>
<text x="308" y="208">𞅃</text>
<text x="290" y="266">𞅄</text>
<text x="251" y="305">𞅅</text>
<text x="192" y="328">𞅆</text>
<text x="133" y="305">𞅇</text>
<text x="84" y="266">𞅈</text>
<text x="78" y="208">𞅉</text>
<text x="84" y="150">𞅁𞅀</text>
<text x="133" y="111">𞅁𞅁</text>
<line id="second" x1="200" y1="200" x2="200" y2="110" stroke="red"></line>
<line id="minute" x1="200" y1="200" x2="200" y2="120" stroke="black"></line>
<line id="hour" x1="200" y1="200" x2="200" y2="130" stroke="black" stroke-width="5"></line>
</svg>
<p><span id="thehour"></span>:<span id="theminute"></span>:<span id="thesecond"></span></p>
</body>
</html>