-
Notifications
You must be signed in to change notification settings - Fork 2
/
data.js
26 lines (26 loc) · 1.12 KB
/
data.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
var foodPlaces = [];
var libraryPlaces = [];
var miscPlaces = [];
function fetchDatabase(callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function (ev) {
if (xhr.readyState == 4 && xhr.status == 200) {
var hoursData_1 = JSON.parse(xhr.responseText);
Object.keys(hoursData_1.foodPlaces).forEach(function (place) {
var placeData = hoursData_1.foodPlaces[place];
foodPlaces.push(new Place(place, placeData));
});
Object.keys(hoursData_1.libraryPlaces).forEach(function (place) {
var placeData = hoursData_1.libraryPlaces[place];
libraryPlaces.push(new Place(place, placeData));
});
Object.keys(hoursData_1.miscPlaces).forEach(function (place) {
var placeData = hoursData_1.miscPlaces[place];
miscPlaces.push(new Place(place, placeData));
});
callback();
}
};
xhr.open("GET", "https://rawgit.com/wiki/ialexryan/whatsopen.caltech.edu/Hours-Database.md?nocache=" + new Date().getTime(), true);
xhr.send();
}