Skip to content

Commit

Permalink
Merge pull request #9 from LoneWanderer-GH/lineColors
Browse files Browse the repository at this point in the history
Add management of icons and line numbers
  • Loading branch information
LoneWanderer-GH authored Feb 17, 2019
2 parents 1a3f893 + 95e7a47 commit e2546d3
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions MMM-Toulouse-Transports.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,17 @@ Module.register( "MMM-Toulouse-Transports", {
var currentDataToDisplay = this.busScheduleData[ scheduleDataIndex ];
var lineNumber = currentDataToDisplay.lineShortName;
var data = currentDataToDisplay.scheduleData;
rgbString = data.departure[0].line.color;
var lineColor = 'rgb'+rgbString

var stopName = data.stop.name;
var stopCode = data.stop.operatorCode;

// put icon
var span = document.createElement("span");
var icon = document.createElement("i");
icon.classList.add("fa-fw");
icon.classList.add("fa-li", "fa", "fa-bus");
icon.classList.add("bright");
span.appendChild(icon);
lineIdCell.appendChild(span);


// put line N°
lineIdCell.innerHTML = lineNumber;
lineIdCell.innerHTML += '<i class="fa fa-bus bright" style="color:'+lineColor+'"></i>' // put icon
lineIdCell.innerHTML += lineNumber;
lineIdCell.style.color = lineColor
row.appendChild(lineIdCell);

// put empty dest cell
Expand All @@ -185,6 +182,7 @@ Module.register( "MMM-Toulouse-Transports", {

// put stopname cell
stopNameCell.innerHTML = stopName + " ("+stopCode+")";
stopNameCell.style.color = lineColor
row.appendChild(stopNameCell);

// create section row
Expand Down

0 comments on commit e2546d3

Please sign in to comment.