diff --git a/CHANGELOG.md b/CHANGELOG.md index 564564cb..7dc1c2b7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 65913d82..d70ec297 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -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.

This value is **REQUIRED** | `units` | What units to use. Specified by config.js

**Possible values:** `config.units` = Specified by config.js, `default` = Kelvin, `metric` = Celsius, `imperial` =Fahrenheit
**Default value:** `config.units` | `roundTemp` | Round temperature value to nearest integer.

**Possible values:** `true` (round to integer) or `false` (display exact value with decimal point)
**Default value:** `false` +| `degreeLabel` | Show the degree label for your chosen units (Metric = C, Imperial = F, Kelvins = K).

**Possible values:** `true` or `false`
**Default value:** `false` | `updateInterval` | How often does the content needs to be fetched? (Milliseconds)

**Possible values:** `1000` - `86400000`
**Default value:** `600000` (10 minutes) | `animationSpeed` | Speed of the update animation. (Milliseconds)

**Possible values:**`0` - `5000`
**Default value:** `1000` (1 second) | `timeFormat` | Use 12 or 24 hour format.

**Possible values:** `12` or `24`
**Default value:** uses value of _config.timeFormat_ diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 135af54a..0632125f 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -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 + "°"; + temperature.innerHTML = " " + this.temperature + "°" + degreeLabel; large.appendChild(temperature); wrapper.appendChild(large);