implemented roundTemperature in weather modules

This commit is contained in:
Olexandr Savchuk
2016-12-02 17:17:58 +01:00
parent c949548150
commit 3c33969d23
4 changed files with 31 additions and 3 deletions

View File

@@ -64,6 +64,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>config.units</code>
</td>
</tr>
<tr>
<td><code>roundTemperature</code></td>
<td>Round temperature value to nearest integer.<br>
<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point)
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>updateInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>

View File

@@ -15,6 +15,7 @@ Module.register("currentweather",{
locationID: false,
appid: "",
units: config.units,
roundTemperature: false,
updateInterval: 10 * 60 * 1000, // every 10 minutes
animationSpeed: 1000,
timeFormat: config.timeFormat,
@@ -181,9 +182,13 @@ Module.register("currentweather",{
weatherIcon.className = "wi weathericon " + this.weatherType;
large.appendChild(weatherIcon);
var temp = this.temperature;
if (this.config.roundTemperature) {
temp = Math.round(temp);
}
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + "&deg;";
temperature.innerHTML = " " + temp + "&deg;";
large.appendChild(temperature);
wrapper.appendChild(large);