-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (32 loc) · 1.1 KB
/
index.js
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
(function () {
function checkTime(i) {
return (i < 10) ? "0" + i : i;
}
function startTime() {
let today = new Date(),
hr = checkTime(today.getHours()),
min = checkTime(today.getMinutes()),
sec = checkTime(today.getSeconds());
document.getElementById('time').innerHTML = hr + ":" + min + ":" + sec;
t = setTimeout(function () {
startTime()
}, 500);
}
startTime();
})();
let date = new Date(),
year = date.getFullYear(),
month = date.getMonth(),
day = date.getDate(),
months = [ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
document.getElementById('date').innerHTML = months[month] + " " + day + " " + year;
let am = 0;
function changeColor() {
if (am == 0) {
document.body.style.background = "linear-gradient(to bottom, #020111 10%,#3a3a52 100%)";
am = 1;
} else {
document.body.style.background = "linear-gradient(to bottom, #82addb 0%,#ebb2b1 100%)";
am = 0;
}
}