Add in degree label to solve issue #753

This commit is contained in:
Andrew McOlash 2017-03-13 06:24:04 -05:00
parent d26d94b62a
commit 3c60feed02
3 changed files with 19 additions and 1 deletions

View File

@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Korean Translation.
- Added console warning on startup when deprecated config options are used
- Added `DAYAFTERTOMORROW`, `UPDATE_NOTIFICATION`, `UPDATE_NOTIFICATION_MODULE`, `UPDATE_INFO` to Norwegian translations (`nn` and `nb`).
- Add option to display temperature unit label
### Fixed
- Update .gitignore to not ignore default modules folder.

View File

@ -33,6 +33,7 @@ The following properties can be configured:
| `appid` | The [OpenWeatherMap](https://home.openweathermap.org) API key, which can be obtained by creating an OpenWeatherMap account. <br><br> This value is **REQUIRED**
| `units` | What units to use. Specified by config.js <br><br> **Possible values:** `config.units` = Specified by config.js, `default` = Kelvin, `metric` = Celsius, `imperial` =Fahrenheit <br> **Default value:** `config.units`
| `roundTemp` | Round temperature value to nearest integer. <br><br> **Possible values:** `true` (round to integer) or `false` (display exact value with decimal point) <br> **Default value:** `false`
| `degreeLabel` | Show the degree label for your chosen units (Metric = C, Imperial = F, Kelvins = K). <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `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)
| `timeFormat` | Use 12 or 24 hour format. <br><br> **Possible values:** `12` or `24` <br> **Default value:** uses value of _config.timeFormat_

View File

@ -24,6 +24,7 @@ Module.register("currentweather",{
useBeaufort: true,
lang: config.language,
showHumidity: false,
degreeLabel: false,
initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500,
@ -182,9 +183,24 @@ Module.register("currentweather",{
weatherIcon.className = "wi weathericon " + this.weatherType;
large.appendChild(weatherIcon);
var degreeLabel = "";
if (this.config.degreeLabel) {
switch (this.config.units ) {
case "metric":
degreeLabel = "C";
break;
case "imperial":
degreeLabel = "F";
break;
case "default":
degreeLabel = "K";
break;
}
}
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + "&deg;";
temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel;
large.appendChild(temperature);
wrapper.appendChild(large);