currentweather, weatherforecast, added option of decimal comma for temperature values to config

This commit is contained in:
Torben Tigges
2017-12-30 22:03:26 +01:00
parent b799609749
commit 46c0e14d67
4 changed files with 28 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ Module.register("currentweather",{
showWindDirectionAsArrow: false,
useBeaufort: true,
lang: config.language,
decimalComma: false,
showHumidity: false,
degreeLabel: false,
showIndoorTemperature: false,
@@ -211,7 +212,12 @@ Module.register("currentweather",{
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + "°" + degreeLabel;
if (this.config.decimalComma) {
temperature.innerHTML = " " + this.temperature.replace(".",",") + "°" + degreeLabel;
}
else {
temperature.innerHTML = " " + this.temperature + "°" + degreeLabel;
}
large.appendChild(temperature);
if (this.config.showIndoorTemperature && this.indoorTemperature) {
@@ -221,7 +227,12 @@ Module.register("currentweather",{
var indoorTemperatureElem = document.createElement("span");
indoorTemperatureElem.className = "bright";
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature + "°" + degreeLabel;
if (this.config.decimalComma) {
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature.replace(".",",") + "°" + degreeLabel;
}
else {
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature + "°" + degreeLabel;
}
large.appendChild(indoorTemperatureElem);
}