Humidity data to the current weather module

This commit is contained in:
Andrew McOlash 2016-08-17 21:51:48 -05:00
parent cf465a1184
commit a7db8cf7cd
3 changed files with 64 additions and 36 deletions

View File

@ -105,6 +105,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showHumidity</code></td>
<td>Show the current humidity<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>useBeaufort</code></td>
<td>Pick between using the Beaufort scale for wind speed or using the default units.<br>

View File

@ -6,3 +6,7 @@
-webkit-transform: translate(0, -3px); /* Safari */
transform: translate(0, -3px);
}
.currentweather .humidity-padding {
padding-bottom: 6px;
}

View File

@ -23,6 +23,7 @@ Module.register("currentweather",{
showWindDirection: true,
useBeaufort: true,
lang: config.language,
showHumidity: false,
initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500,
@ -142,6 +143,21 @@ Module.register("currentweather",{
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
small.appendChild(sunriseSunsetTime);
wrapper.appendChild(small);
if (this.config.showHumidity) {
var middle = document.createElement("div");
middle.className = "normal small humidity-padding";
var humidity = document.createElement("span");
humidity.innerHTML = "Humidity: " + this.humidity + "%"; // TODO: Localization
var br = document.createElement("br");
middle.appendChild(humidity);
middle.appendChild(br);
wrapper.appendChild(middle);
}
var large = document.createElement("div");
large.className = "large light";
@ -154,8 +170,8 @@ Module.register("currentweather",{
temperature.innerHTML = " " + this.temperature + "&deg;";
large.appendChild(temperature);
wrapper.appendChild(small);
wrapper.appendChild(large);
return wrapper;
},
@ -224,6 +240,7 @@ Module.register("currentweather",{
return;
}
this.humidity = parseFloat(data.main.humidity);
this.temperature = this.roundValue(data.main.temp);
if (this.config.useBeaufort){