mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
typo, remove dead code, comments, fix recurring refresh, let fetcher handle it
This commit is contained in:
parent
e8f60d39de
commit
4a7cb88a3e
@ -29,7 +29,7 @@ Module.register("calendar", {
|
|||||||
timeFormat: "relative",
|
timeFormat: "relative",
|
||||||
dateFormat: "MMM Do",
|
dateFormat: "MMM Do",
|
||||||
dateEndFormat: "LT",
|
dateEndFormat: "LT",
|
||||||
fullDayEventDateFormat: "MMM Do HH:mm",
|
fullDayEventDateFormat: "MMM Do",
|
||||||
showEnd: false,
|
showEnd: false,
|
||||||
getRelative: 6,
|
getRelative: 6,
|
||||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||||
@ -41,7 +41,7 @@ Module.register("calendar", {
|
|||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
symbol: "calendar",
|
symbol: "calendar",
|
||||||
url: "https://www.calendarlabs.com/templates/ical/US-Holidays.ics1"
|
url: "https://www.calendarlabs.com/templates/ical/US-Holidays.ics"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
titleReplace: {
|
titleReplace: {
|
||||||
@ -85,6 +85,12 @@ Module.register("calendar", {
|
|||||||
// Set locale.
|
// Set locale.
|
||||||
moment.updateLocale(config.language, this.getLocaleSpecification(config.timeFormat));
|
moment.updateLocale(config.language, this.getLocaleSpecification(config.timeFormat));
|
||||||
|
|
||||||
|
// clear data holder before start
|
||||||
|
this.calendarData = {};
|
||||||
|
|
||||||
|
// indicate no data available yet
|
||||||
|
this.loaded = false;
|
||||||
|
|
||||||
for (var c in this.config.calendars) {
|
for (var c in this.config.calendars) {
|
||||||
var calendar = this.config.calendars[c];
|
var calendar = this.config.calendars[c];
|
||||||
calendar.url = calendar.url.replace("webcal://", "http://");
|
calendar.url = calendar.url.replace("webcal://", "http://");
|
||||||
@ -114,18 +120,10 @@ Module.register("calendar", {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tell helper to start a fetcher for this calendar
|
||||||
|
// fetcher till cycle
|
||||||
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
||||||
|
|
||||||
/* // Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar
|
|
||||||
// fetcher running on the server side.
|
|
||||||
var self = this;
|
|
||||||
setInterval(function () {
|
|
||||||
self.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
|
||||||
}, self.config.fetchInterval); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.calendarData = {};
|
|
||||||
this.loaded = false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override socket notification handler.
|
// Override socket notification handler.
|
||||||
@ -558,9 +556,6 @@ Module.register("calendar", {
|
|||||||
auth: auth,
|
auth: auth,
|
||||||
broadcastPastEvents: calendarConfig.broadcastPastEvents || this.config.broadcastPastEvents
|
broadcastPastEvents: calendarConfig.broadcastPastEvents || this.config.broadcastPastEvents
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
self.addCalendar(url, auth, calendarConfig);
|
|
||||||
}, self.config.fetchInterval);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,11 +340,8 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
newEvents.sort(function (a, b) {
|
// send all our events to upper to merge, sort and reduce for display
|
||||||
return a.startDate - b.startDate;
|
events = newEvents;
|
||||||
});
|
|
||||||
|
|
||||||
events = newEvents.slice(0, maximumEntries);
|
|
||||||
|
|
||||||
self.broadcastEvents();
|
self.broadcastEvents();
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
|
@ -70,7 +70,6 @@ module.exports = NodeHelper.create({
|
|||||||
} else {
|
} else {
|
||||||
Log.log("Use existing calendar fetcher for url: " + url);
|
Log.log("Use existing calendar fetcher for url: " + url);
|
||||||
fetcher = self.fetchers[identifier + url];
|
fetcher = self.fetchers[identifier + url];
|
||||||
//fetcher.broadcastEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetcher.startFetch();
|
fetcher.startFetch();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user