From 7a3ea377985bfacd3316e6b6773b4edfc161192b Mon Sep 17 00:00:00 2001 From: Bryan Zhu Date: Mon, 29 Jun 2020 12:44:24 -0400 Subject: [PATCH] added config option to hide sunrise/sunset in Current Weather module --- CHANGELOG.md | 1 + modules/default/currentweather/currentweather.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f77a0769..003437c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ _This release is scheduled to be released on 2020-07-01._ - Added option to config the level of logging - Added prettier for an even cleaner codebase - Hide Sunrise/Sunset in Weather module +- Hide Sunrise/Sunset in Current Weather module - Added Met Office DataHub (UK) provider ### Updated diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index e0f8be50..d9d06ccb 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -23,6 +23,7 @@ Module.register("currentweather", { lang: config.language, decimalSymbol: ".", showHumidity: false, + showSun: true, degreeLabel: false, showIndoorTemperature: false, showIndoorHumidity: false, @@ -155,13 +156,15 @@ Module.register("currentweather", { small.appendChild(humidityIcon); } - var sunriseSunsetIcon = document.createElement("span"); - sunriseSunsetIcon.className = "wi dimmed " + this.sunriseSunsetIcon; - small.appendChild(sunriseSunsetIcon); + if (this.config.showSun) { + var sunriseSunsetIcon = document.createElement("span"); + sunriseSunsetIcon.className = "wi dimmed " + this.sunriseSunsetIcon; + small.appendChild(sunriseSunsetIcon); - var sunriseSunsetTime = document.createElement("span"); - sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime; - small.appendChild(sunriseSunsetTime); + var sunriseSunsetTime = document.createElement("span"); + sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime; + small.appendChild(sunriseSunsetTime); + } wrapper.appendChild(small); },