-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
52 lines (47 loc) · 1.64 KB
/
index.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
<!DOCTYPE html>
<html>
<div id="screen"></div>
<style>
@font-face {
font-family: 'Google Sans';
font-style: normal;
font-weight: 700;
src: local('Google Sans Bold'), local('GoogleSans- Bold'),
url(https://fonts.gstatic.com/s/googlesans/v13/4UabrENHsxJlGDuGo1OIlLV154tzCwY.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
#screen {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size: 22vw;
font-family: Google Sans;
}
</style>
<script>
function update(){
var colors = ["#DB4437","#F4B400","#F4B400","#0F9D58","#4285F4","#F4B400","#F4B400","#DB4437","#0F9D58","#F4B400","#F4B400","#4285F4"];
var currDate = new Date();
var currHour = currDate.getHours() === 0 ? 24 : currDate.getHours();
var currMinute = currDate.getMinutes();
var currSecond = currDate.getSeconds();
var session = "PM";
if(currHour < 12 || currHour === 24){
session = "AM";
}
if(currHour > 12){
currHour = currHour - 12;
}
var fh = (currHour < 10) ? "0" + currHour : currHour;
var fm = (currMinute < 10) ? "0" + currMinute : currMinute;
var fs = (currSecond < 10) ? "0" + currSecond : currSecond;
var time = fh + ":" + fm + ":" + fs + " " + session;
document.getElementById("screen").innerText = time;
var calc = currMinute%(colors.length/2)*2
document.getElementById("screen").style.color = colors[calc];
document.body.style.backgroundColor = colors[calc + 1];
setTimeout(update, 1000);
}
update();
</script>
</html>