Merge pull request #872 from Arkkimaagi/patch-2

Support showing wind direction with an arrow
This commit is contained in:
Michael Teeuw 2017-05-01 14:29:23 +02:00 committed by GitHub
commit 08d841f6c5
3 changed files with 12 additions and 2 deletions

View File

@ -17,11 +17,11 @@ 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.
- Add support for writing translation fucntions to support flexible word order
- Add test for check if exits the directories present in defaults modules.
- Add ability for `currentweather` module to display indoor temperature via INDOOR_TEMPERATURE notification
### Updated
- Added missing keys to Polish translation.
- Added missing key to German translation.

View File

@ -40,6 +40,7 @@ The following properties can be configured:
| `showPeriod` | Show the period (am/pm) with 12 hour format <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showWindDirection` | Show the wind direction next to the wind speed. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showWindDirectionAsArrow` | Show the wind direction as an arrow instead of abbreviation <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showHumidity` | Show the current humidity <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showIndoorTemperature` | If you have another module that emits the INDOOR_TEMPERATURE notification, the indoor temperature will be displayed <br> **Default value:** `false`
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`

View File

@ -21,6 +21,7 @@ Module.register("currentweather",{
showPeriod: true,
showPeriodUpper: false,
showWindDirection: true,
showWindDirectionAsArrow: false,
useBeaufort: true,
lang: config.language,
showHumidity: false,
@ -95,6 +96,7 @@ Module.register("currentweather",{
this.windSpeed = null;
this.windDirection = null;
this.windDeg = null;
this.sunriseSunsetTime = null;
this.sunriseSunsetIcon = null;
this.temperature = null;
@ -124,7 +126,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 = " &nbsp;<i class=\"fa fa-long-arrow-down\" style=\"transform:rotate("+this.windDeg+"deg);\"></i>&nbsp;";
}
} else {
windDirection.innerHTML = " " + this.translate(this.windDirection);
}
small.appendChild(windDirection);
}
var spacer = document.createElement("span");
@ -346,6 +354,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();