-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththing.js
More file actions
32 lines (28 loc) · 1 KB
/
thing.js
File metadata and controls
32 lines (28 loc) · 1 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
fetch('days.json')
.then(response => response.json())
.then(jsonData => {
var currentDate = new Date().toISOString().split('T')[0];
var matchingDay = jsonData.find(function(day) {
return day.date === currentDate;
});
var pageToLoad = '';
if (matchingDay) {
var dayType = matchingDay.type.toLowerCase();
if (dayType === 'full day') {
pageToLoad = 'full-day.html';
} else if (dayType === 'half day') {
pageToLoad = 'half-day.html';
}
else if (dayType === 'no school') {
pageToLoad = 'no-school.html';
} else if (dayType === 'two hour delay') {
pageToLoad = 'two-hour-delay.html';
}
}
if ((pageToLoad) && (!window.location.href.includes(pageToLoad))) {
window.location.href = pageToLoad;
}
})
.catch(error => {
console.error('Error fetching JSON data:', error);
});