-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
176 lines (170 loc) · 4.5 KB
/
script.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
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
174
175
176
//Display Dynamic Time on Page
function displayTime() {
let currentTime = moment().format('MMMM Do YYYY, HH:mm:ss');
$("#currentDay").text(currentTime);
};
function startTime() {
setInterval(displayTime, 1000)
}
startTime()
//Color coordinate time blocks for past/present/future
function colorCoordinate() {
let timeHours = moment().format('HH');
if (timeHours == 08) {
$("#t08").addClass("present")
}
else if (timeHours > 08) {
$("#t08").addClass("past")
}
else {
$("#t08").addClass("future")
}
if (timeHours == 09) {
$("#t09").addClass("present")
}
else if (timeHours > 09) {
$("#t09").addClass("past")
}
else {
$("#t09").addClass("future")
}
if (timeHours == 10) {
$("#t10").addClass("present")
}
else if (timeHours > 10) {
$("#t10").addClass("past")
}
else {
$("#t10").addClass("future")
}
if (timeHours == 11) {
$("#t11").addClass("present")
}
else if (timeHours > 11) {
$("#t11").addClass("past")
}
else {
$("#t11").addClass("future")
}
if (timeHours == 12) {
$("#t12").addClass("present")
}
else if (timeHours > 12) {
$("#t12").addClass("past")
}
else {
$("#t12").addClass("future")
}
if (timeHours == 13) {
$("#t13").addClass("present")
}
else if (timeHours > 13) {
$("#t13").addClass("past")
}
else {
$("#t13").addClass("future")
}
if (timeHours == 14) {
$("#t14").addClass("present")
}
else if (timeHours > 14) {
$("#t14").addClass("past")
}
else {
$("#t14").addClass("future")
}
if (timeHours == 15) {
$("#t15").addClass("present")
}
else if (timeHours > 15) {
$("#t15").addClass("past")
}
else {
$("#t15").addClass("future")
}
if (timeHours == 16) {
$("#t16").addClass("present")
}
else if (timeHours > 16) {
$("#t16").addClass("past")
}
else {
$("#t16").addClass("future")
}
if (timeHours == 17) {
$("#t17").addClass("present")
}
else if (timeHours > 17) {
$("#t17").addClass("past")
}
else {
$("#t17").addClass("future")
}
if (timeHours == 18) {
$("#t18").addClass("present")
}
else if (timeHours > 18) {
$("#t18").addClass("past")
}
else {
$("#t18").addClass("future")
}
}
colorCoordinate()
//Show local storage values in time blocks on page load
$("#t08").val(window.localStorage.getItem("Task08"));
$("#t09").val(window.localStorage.getItem("Task09"));
$("#t10").val(window.localStorage.getItem("Task10"));
$("#t11").val(window.localStorage.getItem("Task11"));
$("#t12").val(window.localStorage.getItem("Task12"));
$("#t13").val(window.localStorage.getItem("Task13"));
$("#t14").val(window.localStorage.getItem("Task14"));
$("#t15").val(window.localStorage.getItem("Task15"));
$("#t16").val(window.localStorage.getItem("Task16"));
$("#t17").val(window.localStorage.getItem("Task17"));
$("#t18").val(window.localStorage.getItem("Task18"));
//On click of each save button, text area for associated time block is stored into unique local storage area specific to time
$("#s08").click(function(){
let taskValue = $("#t08").val();
localStorage.setItem("Task08", taskValue);
});
$("#s09").click(function(){
let taskValue = $("#t09").val();
localStorage.setItem("Task09", taskValue);
});
$("#s10").click(function(){
let taskValue = $("#t10").val();
localStorage.setItem("Task10", taskValue);
});
$("#s11").click(function(){
let taskValue = $("#t11").val();
localStorage.setItem("Task11", taskValue);
});
$("#s12").click(function(){
let taskValue = $("#t12").val();
localStorage.setItem("Task12", taskValue);
});
$("#s13").click(function(){
let taskValue = $("#t13").val();
localStorage.setItem("Task13", taskValue);
});
$("#s14").click(function(){
let taskValue = $("#t14").val();
localStorage.setItem("Task14", taskValue);
});
$("#s15").click(function(){
let taskValue = $("#t15").val();
localStorage.setItem("Task15", taskValue);
});
$("#s16").click(function(){
let taskValue = $("#t16").val();
localStorage.setItem("Task16", taskValue);
});
$("#s17").click(function(){
let taskValue = $("#t17").val();
localStorage.setItem("Task17", taskValue);
});
$("#s18").click(function(){
let taskValue = $("#t18").val();
localStorage.setItem("Task18", taskValue);
});