-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwastecollectionProvider_0.js
More file actions
50 lines (38 loc) · 1.47 KB
/
wastecollectionProvider_0.js
File metadata and controls
50 lines (38 loc) · 1.47 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
//<provider>0</provider><version>1.0.0</version><parms>"none"</parms>
//just manually provided extra dates
function readCalendar(wasteZipcode, wasteHouseNr, extraDates, enableCreateICS, wasteICSId, wasteStreet, wasteStreetName, wasteCity, wasteFullICSUrl) {
// do nothing
}
function sortArray2(inputarray, extraDates) {
var newArray = inputarray.concat(extraDates);
newArray.sort();
return newArray;
}
function writeWasteDates(wasteDatesString, enableCreateICS) {
var doc2 = new XMLHttpRequest();
doc2.open("PUT", "file:///var/volatile/tmp/wasteDates.txt");
doc2.onreadystatechange=function() {
if (doc2.readyState === 4){
if (doc2.status === 0) {
updateWasteIcon("no");
}
}
}
doc2.send(wasteDatesString);
// create ICS file for use in the calendar app when requested
if (enableCreateICS) {
var outputICS = "";
var tmpICS = wasteDatesString.split("\n");
for (var i = 0; i < tmpICS.length; i++) {
if (tmpICS[i].length > 10) {
outputICS = outputICS + "BEGIN:VEVENT\r\n";
outputICS = outputICS + "DTSTART;VALUE=DATE:" + tmpICS[i].substring(0,4) + tmpICS[i].substring(5,7) + tmpICS[i].substring(8,10) + "\r\n";
outputICS = outputICS + "SUMMARY:" + wasteTypeFriendlyName(tmpICS[i].substring(11,12)) + "\r\n";
outputICS = outputICS + "BEGIN:VEVENT\r\n";
}
}
var doc3 = new XMLHttpRequest();
doc3.open("PUT", "file:///var/volatile/tmp/wasteDates.ics");
doc3.send(outputICS);
}
}