From 0e486b45e18ec49c195d2219721266173f55ffcb Mon Sep 17 00:00:00 2001 From: Mikko Tapionlinna Date: Mon, 24 Apr 2017 23:54:32 +0300 Subject: [PATCH 1/4] Support showing wind direction with an arrow As described in https://github.com/MichMich/MagicMirror/issues/871 this feature lets user use arrow instead of an abbreviation for wind directions. This can be especially helpful on languages like Finnish that do not have all the compass directions English has. --- modules/default/currentweather/currentweather.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 6e23cdcf..f0cb82b5 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -94,6 +94,7 @@ Module.register("currentweather",{ this.windSpeed = null; this.windDirection = null; + this.windDeg = null; this.sunriseSunsetTime = null; this.sunriseSunsetIcon = null; this.temperature = null; @@ -122,7 +123,13 @@ Module.register("currentweather",{ if (this.config.showWindDirection) { var windDirection = document.createElement("sup"); - windDirection.innerHTML = " " + this.translate(this.windDirection); + if (this.config.showWindDirectionAsArrow) { + if(this.windDeg !== null) { + windDirection.innerHTML = "   "; + } + } else { + windDirection.innerHTML = " " + this.translate(this.windDirection); + } small.appendChild(windDirection); } var spacer = document.createElement("span"); @@ -329,6 +336,7 @@ Module.register("currentweather",{ this.windDirection = this.deg2Cardinal(data.wind.deg); + this.windDeg = data.wind.deg; this.weatherType = this.config.iconTable[data.weather[0].icon]; var now = new Date(); From f58787bb50fd9b34e0279b62eb3d474c750591f3 Mon Sep 17 00:00:00 2001 From: Mikko Tapionlinna Date: Fri, 28 Apr 2017 13:58:52 +0300 Subject: [PATCH 2/4] Add documentation for showWindDirectionAsArrow --- modules/default/currentweather/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index d70ec297..bc3d2f3d 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -40,6 +40,7 @@ The following properties can be configured: | `showPeriod` | Show the period (am/pm) with 12 hour format

**Possible values:** `true` or `false`
**Default value:** `true` | `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase

**Possible values:** `true` or `false`
**Default value:** `false` | `showWindDirection` | Show the wind direction next to the wind speed.

**Possible values:** `true` or `false`
**Default value:** `true` +| `showWindDirectionAsArrow` | Show the wind direction as an arrow instead of abbreviation

**Possible values:** `true` or `false`
**Default value:** `false` | `showHumidity` | Show the current humidity

**Possible values:** `true` or `false`
**Default value:** `false` | `onlyTemp` | Show only current Temperature and weather icon.

**Possible values:** `true` or `false`
**Default value:** `false` | `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units.

**Possible values:** `true` or `false`
**Default value:** `true` From 2bc5253725226a76db2e73856d81b2685769f7f5 Mon Sep 17 00:00:00 2001 From: Mikko Tapionlinna Date: Fri, 28 Apr 2017 13:59:07 +0300 Subject: [PATCH 3/4] Set default value for showWindDirectionAsArrow --- modules/default/currentweather/currentweather.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index f0cb82b5..0e149982 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -21,6 +21,7 @@ Module.register("currentweather",{ showPeriod: true, showPeriodUpper: false, showWindDirection: true, + showWindDirectionAsArrow: false, useBeaufort: true, lang: config.language, showHumidity: false, From 5f80deb5b78eea86be91d9d25c91ee5a5f17bf70 Mon Sep 17 00:00:00 2001 From: Mikko Tapionlinna Date: Fri, 28 Apr 2017 15:33:32 +0300 Subject: [PATCH 4/4] Added direction as an arrow feature to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de0802f4..1bff7e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add test of match current week number on clock module with showWeek configuration. - Add test default modules present modules/default/defaultmodules.js. - Add unit test calendar_modules function capFirst. +- Add support for showing wind direction as an arrow instead of abbreviation in currentWeather module. ### Updated - Added missing keys to Polish translation.