From 836148a3355c509dd43e503dd3dc30659d945c44 Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 16:15:05 -0500 Subject: [PATCH 1/9] Update currentweather.js --- .../default/currentweather/currentweather.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 6c6aa1002b..864750166a 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -19,6 +19,7 @@ Module.register("currentweather",{ timeFormat: config.timeFormat, showPeriod: true, showPeriodUpper: false, + showDirection: false, lang: config.language, initialLoadDelay: 0, // 0 seconds delay @@ -68,6 +69,7 @@ Module.register("currentweather",{ moment.locale(config.language); this.windSpeed = null; + this.windDirection = null; this.sunriseSunsetTime = null; this.sunriseSunsetIcon = null; this.temperature = null; @@ -112,6 +114,10 @@ Module.register("currentweather",{ var windSpeed = document.createElement("span"); windSpeed.innerHTML = " " + this.windSpeed; small.appendChild(windSpeed); + + var windDirection = document.createElement("span"); + windDirection.innerHTML = " " + this.windDirection; + small.appendChild(windDirection); var spacer = document.createElement("span"); spacer.innerHTML = " "; @@ -198,6 +204,9 @@ Module.register("currentweather",{ processWeather: function(data) { this.temperature = this.roundValue(data.main.temp); this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed)); + if (this.showDirection) { + this.windDirection = this.deg2Cardinal(data.wind.deg); + } else {} this.weatherType = this.config.iconTable[data.weather[0].icon]; var now = new Date(); @@ -274,6 +283,44 @@ Module.register("currentweather",{ * * return number - Rounded Temperature. */ + + deg2Card: function(deg) { + if (deg>11.25 && deg<33.75){ + return "NNE"; + }else if (deg>33.75 && deg<56.25){ + return "ENE"; + }else if (deg>56.25 && deg<78.75){ + return "E"; + }else if (deg>78.75 && deg<101.25){ + return "ESE"; + }else if (deg>101.25 && deg<123.75){ + return "ESE"; + }else if (deg>123.75 && deg<146.25){ + return "SE"; + }else if (deg>146.25 && deg<168.75){ + return "SSE"; + }else if (deg>168.75 && deg<191.25){ + return "S"; + }else if (deg>191.25 && deg<213.75){ + return "SSW"; + }else if (deg>213.75 && deg<236.25){ + return "SW"; + }else if (deg>236.25 && deg<258.75){ + return "WSW"; + }else if (deg>258.75 && deg<281.25){ + return "W"; + }else if (deg>281.25 && deg<303.75){ + return "WNW"; + }else if (deg>303.75 && deg<326.25){ + return "NW"; + }else if (deg>326.25 && deg<348.75){ + return "NNW"; + }else{ + return "N"; + } + } + + roundValue: function(temperature) { return parseFloat(temperature).toFixed(1); } From 77cb8530e5cae8c1a207ff94f502a4943785c24f Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 16:55:39 -0500 Subject: [PATCH 2/9] Update currentweather.js --- modules/default/currentweather/currentweather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 864750166a..7c1166726c 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -284,7 +284,7 @@ Module.register("currentweather",{ * return number - Rounded Temperature. */ - deg2Card: function(deg) { + deg2Cardinal: function(deg) { if (deg>11.25 && deg<33.75){ return "NNE"; }else if (deg>33.75 && deg<56.25){ From 8d29bd5c322aa0fde0b0825c90733129bfb3c08e Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 17:40:18 -0500 Subject: [PATCH 3/9] Update currentweather.js --- modules/default/currentweather/currentweather.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 7c1166726c..ea9f7fa2a0 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -19,7 +19,7 @@ Module.register("currentweather",{ timeFormat: config.timeFormat, showPeriod: true, showPeriodUpper: false, - showDirection: false, + showDirection: true, lang: config.language, initialLoadDelay: 0, // 0 seconds delay @@ -110,15 +110,17 @@ Module.register("currentweather",{ var windIcon = document.createElement("span"); windIcon.className = "wi wi-strong-wind dimmed"; small.appendChild(windIcon); - + var windSpeed = document.createElement("span"); windSpeed.innerHTML = " " + this.windSpeed; small.appendChild(windSpeed); - var windDirection = document.createElement("span"); - windDirection.innerHTML = " " + this.windDirection; - small.appendChild(windDirection); - + if (this.showDirection) { + var windDirection = document.createElement("span"); + windDirection.innerHTML = " " + this.windDirection; + small.appendChild(windDirection); + } + var spacer = document.createElement("span"); spacer.innerHTML = " "; small.appendChild(spacer); @@ -318,7 +320,7 @@ Module.register("currentweather",{ }else{ return "N"; } - } + }, roundValue: function(temperature) { From 2aae0528b55bc85771a72a4fe2e49fcc5a21bd84 Mon Sep 17 00:00:00 2001 From: "Warwolf8.9" Date: Sun, 24 Apr 2016 18:06:12 -0500 Subject: [PATCH 4/9] Added wind direction in Current Weather module --- modules/default/currentweather/currentweather.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index ea9f7fa2a0..d40593a840 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -19,7 +19,7 @@ Module.register("currentweather",{ timeFormat: config.timeFormat, showPeriod: true, showPeriodUpper: false, - showDirection: true, + showDirection: false, lang: config.language, initialLoadDelay: 0, // 0 seconds delay @@ -114,13 +114,12 @@ Module.register("currentweather",{ var windSpeed = document.createElement("span"); windSpeed.innerHTML = " " + this.windSpeed; small.appendChild(windSpeed); - - if (this.showDirection) { + + if (this.config.showDirection) { var windDirection = document.createElement("span"); windDirection.innerHTML = " " + this.windDirection; small.appendChild(windDirection); } - var spacer = document.createElement("span"); spacer.innerHTML = " "; small.appendChild(spacer); @@ -206,9 +205,7 @@ Module.register("currentweather",{ processWeather: function(data) { this.temperature = this.roundValue(data.main.temp); this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed)); - if (this.showDirection) { - this.windDirection = this.deg2Cardinal(data.wind.deg); - } else {} + this.windDirection = this.deg2Cardinal(data.wind.deg); this.weatherType = this.config.iconTable[data.weather[0].icon]; var now = new Date(); From db9e615e4d9970111da574f06713b5584833a059 Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 18:30:54 -0500 Subject: [PATCH 5/9] Update README.md --- modules/default/currentweather/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 3f1f2af416..2b3a5300d7 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -14,7 +14,8 @@ modules: [ config: { // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', - appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. + appid: 'abcde12345abcde12345abcde12345ab', //openweathermap.org API key. + showWindDirection: true } } ] @@ -90,6 +91,13 @@ The following properties can be configured:
Default value: false + + showWindDirection + Show the wind direction next to the wind speed.
+
Possible values: true or false +
Default value: false + + lang The language of the days.
From 5a5f5318d1bd5ef6e8649622ff53cb4aff72c87f Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 18:31:46 -0500 Subject: [PATCH 6/9] Update README.md --- modules/default/currentweather/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 2b3a5300d7..585a0ae424 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -15,7 +15,7 @@ modules: [ // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', appid: 'abcde12345abcde12345abcde12345ab', //openweathermap.org API key. - showWindDirection: true + showWindDirection: true, } } ] From 5f8ef64ca439ac6e8e152ea1d8313c4e99535eab Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Sun, 24 Apr 2016 18:34:39 -0500 Subject: [PATCH 7/9] showDirection to showWindDirection --- modules/default/currentweather/currentweather.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index d40593a840..4ab04c4fdf 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -19,7 +19,7 @@ Module.register("currentweather",{ timeFormat: config.timeFormat, showPeriod: true, showPeriodUpper: false, - showDirection: false, + showWindDirection: false, lang: config.language, initialLoadDelay: 0, // 0 seconds delay @@ -115,7 +115,7 @@ Module.register("currentweather",{ windSpeed.innerHTML = " " + this.windSpeed; small.appendChild(windSpeed); - if (this.config.showDirection) { + if (this.config.showWindDirection) { var windDirection = document.createElement("span"); windDirection.innerHTML = " " + this.windDirection; small.appendChild(windDirection); From 74c96d8521d4ad80c2e6ad3842c9bb445a116e9b Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Mon, 25 Apr 2016 06:23:55 -0500 Subject: [PATCH 8/9] Removed showWindDirection --- modules/default/currentweather/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 585a0ae424..eb592001e4 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -15,7 +15,6 @@ modules: [ // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', appid: 'abcde12345abcde12345abcde12345ab', //openweathermap.org API key. - showWindDirection: true, } } ] From 8562bdfc4a13ac36e27dadec5c933d1200a97bc1 Mon Sep 17 00:00:00 2001 From: roxasvalor Date: Mon, 25 Apr 2016 06:27:26 -0500 Subject: [PATCH 9/9] Removed trailing comma --- modules/default/currentweather/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index eb592001e4..2ce54aacdf 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -14,7 +14,7 @@ modules: [ config: { // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', - appid: 'abcde12345abcde12345abcde12345ab', //openweathermap.org API key. + appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. } } ]