Merge pull request #1011 from qistoph/fix_on_991

Fix on 991
This commit is contained in:
Michael Teeuw 2017-09-06 14:40:32 +02:00 committed by GitHub
commit 701a7cae02

View File

@ -140,27 +140,28 @@ Module.register("weatherforecast",{
icon.className = "wi weathericon " + forecast.icon; icon.className = "wi weathericon " + forecast.icon;
iconCell.appendChild(icon); iconCell.appendChild(icon);
var maxTempCell = document.createElement("td"); var degreeLabel = "";
maxTempCell.innerHTML = forecast.maxTemp; if(this.config.scale) {
if(this.config.scale.toUpperCase() == "C") { switch(this.config.units) {
maxTempCell.innerHTML += " °C"; case "metric":
} else { degreeLabel = " °C";
if(this.config.scale.toUpperCase() == "F") { break;
maxTempCell.innerHTML += " °F"; case "imperial":
degreeLabel = " °F";
break;
case "default":
degreeLabel = "K";
break;
} }
} }
var maxTempCell = document.createElement("td");
maxTempCell.innerHTML = forecast.maxTemp + degreeLabel;
maxTempCell.className = "align-right bright max-temp"; maxTempCell.className = "align-right bright max-temp";
row.appendChild(maxTempCell); row.appendChild(maxTempCell);
var minTempCell = document.createElement("td"); var minTempCell = document.createElement("td");
minTempCell.innerHTML = forecast.minTemp; minTempCell.innerHTML = forecast.minTemp + degreeLabel;
if(this.config.scale.toUpperCase() == "C") {
minTempCell.innerHTML += " °C";
} else {
if(this.config.scale.toUpperCase() == "F") {
minTempCell.innerHTML += " °F";
}
}
minTempCell.className = "align-right min-temp"; minTempCell.className = "align-right min-temp";
row.appendChild(minTempCell); row.appendChild(minTempCell);