mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
implemented roundTemperature in weather modules
This commit is contained in:
parent
c949548150
commit
3c33969d23
@ -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>
|
||||
|
@ -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 + "°";
|
||||
temperature.innerHTML = " " + temp + "°";
|
||||
large.appendChild(temperature);
|
||||
|
||||
wrapper.appendChild(large);
|
||||
|
@ -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 values 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>maxNumberOfDays</code></td>
|
||||
<td>How many days of forecast to return. Specified by config.js<br>
|
||||
|
@ -15,6 +15,7 @@ Module.register("weatherforecast",{
|
||||
locationID: false,
|
||||
appid: "",
|
||||
units: config.units,
|
||||
roundTemperature: false,
|
||||
maxNumberOfDays: 7,
|
||||
showRainAmount: false,
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
@ -133,13 +134,20 @@ Module.register("weatherforecast",{
|
||||
icon.className = "wi weathericon " + forecast.icon;
|
||||
iconCell.appendChild(icon);
|
||||
|
||||
var maxTemp = forecast.maxTemp;
|
||||
var minTemp = forecast.minTemp;
|
||||
if (this.config.roundTemperature) {
|
||||
maxTemp = Math.round(maxTemp);
|
||||
minTemp = Math.round(minTemp);
|
||||
}
|
||||
|
||||
var maxTempCell = document.createElement("td");
|
||||
maxTempCell.innerHTML = forecast.maxTemp;
|
||||
maxTempCell.innerHTML = maxTemp;
|
||||
maxTempCell.className = "align-right bright max-temp";
|
||||
row.appendChild(maxTempCell);
|
||||
|
||||
var minTempCell = document.createElement("td");
|
||||
minTempCell.innerHTML = forecast.minTemp;
|
||||
minTempCell.innerHTML = minTemp;
|
||||
minTempCell.className = "align-right min-temp";
|
||||
row.appendChild(minTempCell);
|
||||
|
||||
@ -352,3 +360,4 @@ Module.register("weatherforecast",{
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user