Added the ability to hide the temp label and weather icon in the currentweather module to allow showing only information such as wind and sunset/rise.

This commit is contained in:
Adi Miller 2020-01-16 16:26:20 +02:00
parent 0ca00e5059
commit 81aab7e86f
2 changed files with 31 additions and 27 deletions

View File

@ -13,7 +13,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- cleanup installers folder, remove externalized scripts - cleanup installers folder, remove externalized scripts
### Added ### Added
- Finnish translation for "PRECIP", "UPDATE_INFO_MULTIPLE" and "UPDATE_INFO_SINGLE". - Finish translation for "PRECIP", "UPDATE_INFO_MULTIPLE" and "UPDATE_INFO_SINGLE".
- Added the ability to hide the temp label and weather icon in the `currentweather` module to allow showing only information such as wind and sunset/rise.
### Fixed ### Fixed
- Force declaration of public ip adress in config file (ISSUE #1852) - Force declaration of public ip adress in config file (ISSUE #1852)

View File

@ -44,6 +44,7 @@ Module.register("currentweather",{
calendarClass: "calendar", calendarClass: "calendar",
onlyTemp: false, onlyTemp: false,
hideTemp: false,
roundTemp: false, roundTemp: false,
iconTable: { iconTable: {
@ -194,36 +195,38 @@ Module.register("currentweather",{
var large = document.createElement("div"); var large = document.createElement("div");
large.className = "large light"; large.className = "large light";
var weatherIcon = document.createElement("span"); if (this.config.hideTemp === true) {
weatherIcon.className = "wi weathericon " + this.weatherType; var weatherIcon = document.createElement("span");
large.appendChild(weatherIcon); weatherIcon.className = "wi weathericon " + this.weatherType;
large.appendChild(weatherIcon);
var degreeLabel = ""; var degreeLabel = "";
if (this.config.units === "metric" || this.config.units === "imperial") { if (this.config.units === "metric" || this.config.units === "imperial") {
degreeLabel += "°"; degreeLabel += "°";
} }
if(this.config.degreeLabel) { if(this.config.degreeLabel) {
switch(this.config.units) { switch(this.config.units) {
case "metric": case "metric":
degreeLabel += "C"; degreeLabel += "C";
break; break;
case "imperial": case "imperial":
degreeLabel += "F"; degreeLabel += "F";
break; break;
case "default": case "default":
degreeLabel += "K"; degreeLabel += "K";
break; break;
}
} }
}
if (this.config.decimalSymbol === "") { if (this.config.decimalSymbol === "") {
this.config.decimalSymbol = "."; this.config.decimalSymbol = ".";
} }
var temperature = document.createElement("span"); var temperature = document.createElement("span");
temperature.className = "bright"; temperature.className = "bright";
temperature.innerHTML = " " + this.temperature.replace(".", this.config.decimalSymbol) + degreeLabel; temperature.innerHTML = " " + this.temperature.replace(".", this.config.decimalSymbol) + degreeLabel;
large.appendChild(temperature); large.appendChild(temperature);
}
if (this.config.showIndoorTemperature && this.indoorTemperature) { if (this.config.showIndoorTemperature && this.indoorTemperature) {
var indoorIcon = document.createElement("span"); var indoorIcon = document.createElement("span");