-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
78 lines (66 loc) · 2.15 KB
/
index.js
File metadata and controls
78 lines (66 loc) · 2.15 KB
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
class Time {
constructor(hours, minutes, seconds, AMPM) {
this.timeArray = [0, 0, 0, 0]
this.date = new Date();
this.timeArray[0] = hours || this.date.getHours();
this.timeArray[1] = minutes || this.date.getMinutes();
this.timeArray[2] = seconds || this.date.getSeconds();
this.timeArray[3] = AMPM || "";
if (this.timeArray[3] == "") {
if (this.timeArray[0] > 12) {
this.timeArray[0] -= 12;
this.timeArray[3] = "PM";
} else {
this.timeArray[3] = "AM";
}
}
if (this.timeArray[0] == 0) {
this.timeArray[0] = 12;
}
for (var i = 1; i < this.timeArray.length - 1; i++) {
if (this.timeArray[i].toString().length == 1) {
this.timeArray[i] = "0" + this.timeArray[i].toString();
}
this.timeArray[i] = this.timeArray[i].toString();
}
}
getAMPM() {
return this.timeArray[3];
}
shortString() {
return this.timeArray[0] + ":" + this.timeArray[1];
}
toString() {
return this.timeArray[0] + ":" + this.timeArray[1] + ":" + this.timeArray[2] + " " + this.timeArray[3];
}
}
class Day {
}
class TimeBlock {
constructor(startTime, endTime) {
this.startTime = startTime;
this.endTime = endTime;
}
}
function openCloseNav() {
if (document.getElementById("mySidenav").style.width == "250px") {
document.getElementById("mySidenav").style.width = "0px";
document.getElementById("mySidenav").style.paddingRight = "0px";
document.getElementById("menuButton").style.transform = "translate(16px, 16px) rotate(0deg)";
} else {
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("mySidenav").style.paddingRight = "110px";
document.getElementById("menuButton").style.transform = "translate(16px, 16px) rotate(270deg)";
}
}
document.addEventListener('DOMContentLoaded', function() {
var link = document.getElementById('menuButton');
link.addEventListener('click', function() {
openCloseNav();
});
});
window.onload = setInterval(function() {
time = new Time();
//block = new TimeBlock(, );
document.getElementById("time").innerHTML = time.shortString();
}, 200);