diff --git a/MMM-Ruter.js b/MMM-Ruter.js index e0924fa..2ac8b5b 100755 --- a/MMM-Ruter.js +++ b/MMM-Ruter.js @@ -73,12 +73,27 @@ Module.register("MMM-Ruter",{ if (this.config.showHeader) { table.appendChild(this.getTableHeaderRow()); } - + + var shouldAddLine = function (journey, stops) { + for (var i = 0; i < stops.length; i++) { + if(stops[i].stopId == journey.stopId) { + if(stops[i].lineNames === undefined) { return true }; + if(stops[i].lineNames.indexOf(journey.lineName) != -1) { + return true + } else { return false } + } else { return false } + } + + }; + for(var i = 0; i < this.journeys.length; i++) { var journey = this.journeys[i]; var tr = this.getTableRow(journey); + if(!shouldAddLine(journey, this.config.stops)){ + continue; + } // Create fade effect. <-- stolen from default "calendar" module if (this.config.fade && this.config.fadePoint < 1) { if (this.config.fadePoint < 0) { @@ -318,4 +333,4 @@ Module.register("MMM-Ruter",{ return moment(t).format(this.config.timeFormat); } } -}); +}); \ No newline at end of file diff --git a/README.md b/README.md index e0f75f9..fd84251 100755 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ stopId | Id of stop stopName | Override name of the stop if you know it by another name or want to keep it short. You have to enable `showStopName` in module configuration. platformFilter | The names of the platforms you want to see. Please temporarely enable `showPlatformName` in the module configuration to get the correct platform names before you configure this option. If these names aren't valid, nothing will be displayed. timeToThere | How long time in minutes does it take for you to get to this stop? It's no point showing journeys that till go in 1 minute if it takes you 5 minutes to get there... +lineNames | List the lines relevant to you. Example: `lineNames: ["17", "31"]` will only show line 17 and line 31. Example: ```