-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.html
154 lines (144 loc) · 3.24 KB
/
status.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
<!DOCTYPE html>
<html>
<head>
<title>Javascript</title>
<style type="text/css">
.MonAM {
background-color:red;
grid-area: MonAM;
width:200px;
height:200px;
margin:5px;
border-radius:25px;
text-align: center;
}
.MonPM {
background-color:red;
grid-area: MonPM;
width:200px;
height:200px;
margin:5px;
border-radius:25px;
}
.TueAM {
background-color:red;
grid-area: TueAM;
width:200px;
height:200px;
margin:5px;
border-radius:25px;
}
.TuePM {
background-color:red;
grid-area: TuePM;
width:200px;
height:200px;
margin:5px;
border-radius:25px;
}
.square {
background-color:red;
width:150px;
height:100px;
margin:5px;
border-radius:25px;
text-align: center;
font-size: 120%
}
</style>
</head>
<body>
<center>
<table>
<tr>
<td>
<div id="MonAM" class=square>Monday AM</div>
</td>
<td>
<div id="MonPM" class=square>Monday PM</div>
</td>
</tr>
<tr>
<td>
<div id="TueAM" class=square>Tuesday AM</div>
</td>
<td>
<div id="TuePM" class=square>Tuesday PM</div>
</td>
</tr>
<tr>
<td>
<div id="WedAM" class=square>Wednesday AM</div>
</td>
<td>
<div id="WedPM" class=square>Wednesday PM</div>
</td>
</tr>
<tr>
<td>
<div id="ThuAM" class=square>Thursday AM</div>
</td>
<td>
<div id="ThuPM" class=square>Thursday PM</div>
</td>
</tr>
<tr>
<td>
<div id="FriAM" class=square>Friday AM</div>
</td>
<td>
<div id="FriPM" class=square>Friday PM</div>
</td>
</tr>
<tr>
<td>
<div id="SatAM" class=square>Saturday AM</div>
</td>
<td>
<div id="SatPM" class=square>Saturday PM</div>
</td>
</tr>
<tr>
<td>
<div id="SunAM" class=square>Sunday AM</div>
</td>
<td>
<div id="SunPM" class=square>Sunday PM</div>
</td>
</tr>
</table>
</center>
<script type="text/javascript">
document.getElementById("MonAM").innerHTML = "Monday Morning";
// document.getElementById("MonAM").style.backgroundColor = "green";
// document.getElementById("SatPM").style.backgroundColor = "green"
function fetchJSONFile(path, callback) {
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var data = JSON.parse(httpRequest.responseText);
if (callback) callback(data);
}
}
};
httpRequest.open('GET', path);
httpRequest.send();
}
fetchJSONFile('the_data.txt', function(data){
// console.log(data[0]["MonPM"]["time"]);
var days = "";
var x;
for (x in data) {
console.log(x);
console.log(data[x]["current"]);
if (data[x]["current"] == 1) {
console.log(data[x]["current"]);
document.getElementById(x).style.backgroundColor = "green";
document.getElementById(x).innerHTML = document.getElementById(x).innerHTML + "<br>" + data[x]["time"];
}
}
});
</script>
</body>
</html>