mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
currentweather, weatherforecast, added option of decimal comma for temperature values to config
This commit is contained in:
parent
b799609749
commit
46c0e14d67
@ -46,6 +46,7 @@ The following properties can be configured:
|
||||
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
|
||||
| `decimalComma` | Whether or not to show a decimal comma instead of a decimal point for temperature values.<br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `0`
|
||||
| `retryDelay` | The delay before retrying after a request failure. (Milliseconds) <br><br> **Possible values:** `1000` - `60000` <br> **Default value:** `2500`
|
||||
| `apiVersion` | The OpenWeatherMap API version to use. <br><br> **Default value:** `2.5`
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ The following properties can be configured:
|
||||
| `updateInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `600000` (10 minutes)
|
||||
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `1000` (1 second)
|
||||
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
|
||||
| `decimalComma` | Whether or not to show a decimal comma instead of a decimal point for temperature values.<br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `fadePoint` | Where to start fade? <br><br> **Possible values:** `0` (top of the list) - `1` (bottom of list) <br> **Default value:** `0.25`
|
||||
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `2500` (2.5 seconds delay. This delay is used to keep the OpenWeather API happy.)
|
||||
|
@ -21,6 +21,7 @@ Module.register("weatherforecast",{
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
lang: config.language,
|
||||
decimalComma: false,
|
||||
fade: true,
|
||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||
colored: false,
|
||||
@ -156,12 +157,22 @@ Module.register("weatherforecast",{
|
||||
}
|
||||
|
||||
var maxTempCell = document.createElement("td");
|
||||
maxTempCell.innerHTML = forecast.maxTemp + degreeLabel;
|
||||
if (this.config.decimalComma) {
|
||||
maxTempCell.innerHTML = forecast.maxTemp.replace(".",",") + degreeLabel;
|
||||
}
|
||||
else {
|
||||
maxTempCell.innerHTML = forecast.maxTemp + degreeLabel;
|
||||
}
|
||||
maxTempCell.className = "align-right bright max-temp";
|
||||
row.appendChild(maxTempCell);
|
||||
|
||||
var minTempCell = document.createElement("td");
|
||||
minTempCell.innerHTML = forecast.minTemp + degreeLabel;
|
||||
if (this.config.decimalComma) {
|
||||
minTempCell.innerHTML = forecast.minTemp.replace(".",",") + degreeLabel;
|
||||
}
|
||||
else {
|
||||
minTempCell.innerHTML = forecast.minTemp + degreeLabel;
|
||||
}
|
||||
minTempCell.className = "align-right min-temp";
|
||||
row.appendChild(minTempCell);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user