diff --git a/CHANGELOG.md b/CHANGELOG.md index a6c81e2..41b0841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ -# MMM-SwissCommute Change Log +# MMM-SwissCommute Changelog + +## [1.1.0] - May 1st 2020 + +- Added icons based on transport type +- Fixed CSS for multiple instaces ## [1.0.0] - Dec 10th 2017 -Initial Release \ No newline at end of file +Initial Release diff --git a/MMM-SwissCommute.js b/MMM-SwissCommute.js index 6e6d99c..b491adc 100755 --- a/MMM-SwissCommute.js +++ b/MMM-SwissCommute.js @@ -84,7 +84,7 @@ Module.register("MMM-SwissCommute",{ } if (!this.loaded) { - wrapper.innerHTML = "Loading trains ..."; + wrapper.innerHTML = "Loading connections ..."; wrapper.className = "dimmed light small"; return wrapper; } @@ -104,9 +104,33 @@ Module.register("MMM-SwissCommute",{ var row = document.createElement("tr"); table.appendChild(row); - // Number + // Number & Icon + var icon = ""; + switch(trains.type) { + case "train": + icon = "fa-train"; + break; + case "strain": + icon = "fa-train"; + break; + case "bus": + icon = "fa-bus"; + break; + case "tram": + icon = "fa-subway"; + break; + case "ship": + icon = "fa-ship"; + break; + case "cableway": + icon = "fa-tram"; + break; + default: + icon = "fa-train"; + } + var trainNumberCell = document.createElement("td"); - trainNumberCell.innerHTML = " " + trains.number; + trainNumberCell.innerHTML = " " + trains.number; trainNumberCell.className = "align-left"; row.appendChild(trainNumberCell); @@ -230,6 +254,7 @@ Module.register("MMM-SwissCommute",{ departureTimestamp: moment(trains.departure).format("HH:mm"), delay: parseInt(trains.dep_delay), to: trains.legs[0].terminal, + type: trains.legs[0].type, number: trains.legs[0].line, track: trains.legs[0].track }; diff --git a/package.json b/package.json index 994a1d7..050d465 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MMM-SwissCommute", - "version": "1.0.0", + "version": "1.1.0", "description": "A MagicMirror Module to display the next departures for your favorite (train) connection in Switzerland", "main": "MMM-SwissCommute.js", "author": "nixnuex",