-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
173 lines (161 loc) · 3.8 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en">
<head>
<title>PRESS R TO RESTART</title>
<link rel="stylesheet" type="text/css" href="site.css">
<!-- Google fonts -->
<link href="https://fonts.googleapis.com/css?family=Damion|Press+Start+2P" rel="stylesheet">
</head>
<body>
<div class="content">
<!-- DateTime -->
<div id="DateTime" class="centered contentItem">
<div id="Time">
<time id="currentTime1"></time>
<time id="currentTime2"></time>
<time id="currentTime3"></time>
</div>
<div id="Date">
<span id="currentDate1"></span>
<span id="currentDate2"></span>
</div>
</div> <!-- end DateTime -->
<!-- Links -->
<div id="Links" class="centered contentItem">
<a href="#">Link A</a>
<a href="#">Link B</a>
<a href="#">Link C</a>
<a href="#">Link D</a>
</div> <!-- end Links -->
<!-- Search -->
<div id="Search" class="centered contentItem">
<form action="https://www.duckduckgo.com/" method="get">
<input type="search" autocomplete="off" placeholder="search..." name="q" class="searchbox" autofocus>
<input type="submit" value="search" style="display:none; ">
</form>
</div> <!-- end Search -->
</div> <!-- end content -->
<script>
function setTime() {
var dateTime = new Date();
// Time
var theTime = ""; // variable to update the displayed time
var hours = dateTime.getHours();
var mins = dateTime.getMinutes();
// Set AM or PM and hours
var ampm = "AM";
if(hours > 12) {
hours -= 12;
ampm = "PM";
}
else if (hours == 0) {
// To change 0:00 AM to 12:00 AM
hours = 12;
}
theTime += hours + " . ";
// Set minutes
if(mins < 10) {
theTime += "0" + mins;
}
else {
theTime += mins;
}
theTime += " " + ampm;
// Date
var theDate = ""; // variable to update the displayed date
// Set day of the week
switch(dateTime.getDay()) {
case 0:
theDate += "Sunday";
break;
case 1:
theDate += "Monday";
break;
case 2:
theDate += "Tueday";
break;
case 3:
theDate += "Wednesday";
break;
case 4:
theDate += "Thursday";
break;
case 5:
theDate += "Friday";
break;
case 6:
theDate += "Saturday";
break;
default:
theDate += "day";
}
theDate += ", ";
// Set month
switch(dateTime.getMonth()) {
case 0:
theDate += "January";
break;
case 1:
theDate += "February";
break;
case 2:
theDate += "March";
break;
case 3:
theDate += "April";
break;
case 4:
theDate += "May";
break;
case 5:
theDate += "June";
break;
case 6:
theDate += "July";
break;
case 7:
theDate += "August";
break;
case 8:
theDate += "September";
break;
case 9:
theDate += "October";
break;
case 10:
theDate += "November";
break;
case 11:
theDate += "December";
break;
default:
theDate += "Invalid Month";
}
// Set day of the month
var dayOfTheMonth = dateTime.getDate();
theDate += " " + dayOfTheMonth;
switch(dayOfTheMonth) {
case 1: case 21: case 31:
theDate += "st";
break;
case 2: case 22:
theDate += "nd";
break;
case 3: case 23:
theDate += "rd";
break;
default:
theDate += "th";
}
// Update html elements
document.getElementById("currentTime1").innerHTML = theTime;
document.getElementById("currentTime2").innerHTML = theTime;
document.getElementById("currentTime3").innerHTML = theTime;
document.getElementById("currentDate1").innerHTML = theDate;
document.getElementById("currentDate2").innerHTML = theDate;
}
setTime(); // initial call to setTime
setInterval(setTime, 5000); // setTime every 5 seconds
</script>
</body>
</html>