From 0e486b45e18ec49c195d2219721266173f55ffcb Mon Sep 17 00:00:00 2001 From: Mikko Tapionlinna Date: Mon, 24 Apr 2017 23:54:32 +0300 Subject: [PATCH] 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();