Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MMM-WeeklySchedule.js to support an array of timeslots. #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion MMM-WeeklySchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
*
* By Ulrich Pinsdorf
* MIT Licensed.
*
* 06/24/2024 - Unclearogre - Added support for an array of timeslots instead of
* a single timeslot list. Note that it still supports
* the single timeslot list so it won't break anything.
* Also supports a default set of times ("def:") in the
* timeslot array.
*/

Module.register("MMM-WeeklySchedule", {
Expand Down Expand Up @@ -64,7 +70,16 @@ Module.register("MMM-WeeklySchedule", {
}

// get timeslots
var timeslots = this.config.schedule.timeslots;
//var timeslots = this.config.schedule.timeslots;
var timeslots = this.config.schedule.timeslots[dow];
if(timeslots == undefined)
{
timeslots = this.config.schedule.timeslots["def"];
}
if(timeslots == undefined)
{
timeslots = this.config.schedule.timeslots;
}

// build table with timeslot definitions and lessons
wrapper = document.createElement("table");
Expand Down