From 8fa93a9683a4c61980df96cdedc8703781131667 Mon Sep 17 00:00:00 2001 From: Krouty Date: Tue, 23 Nov 2021 14:58:58 +0100 Subject: [PATCH 1/2] fix header display #29 Solving issue #29 had an error displaying the header of the module correctly. It was hidden in every case. This is supposed to be fixed now. --- MMM-DWD-WarnWeather.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/MMM-DWD-WarnWeather.js b/MMM-DWD-WarnWeather.js index 6d8dfcd..e3bb37e 100644 --- a/MMM-DWD-WarnWeather.js +++ b/MMM-DWD-WarnWeather.js @@ -97,9 +97,6 @@ Module.register("MMM-DWD-WarnWeather", { if (this.config.displayInnerHeader) { wrapper.appendChild(header); } - if (this.warnings.length < 1 && this.config.hideNoWarning) { - this.data.header = ''; - } var locNotFound = document.createElement("div"); locNotFound.className = 'locationNotFound'; @@ -172,13 +169,24 @@ Module.register("MMM-DWD-WarnWeather", { warnWrapper.appendChild(icon); warnWrapper.appendChild(description); wrapper.appendChild(warnWrapper); - wrapper.appendChild(newLine); - + wrapper.appendChild(newLine1); + if (this.warnings.length > 1) { + wrapper.appendChild(newLine2); + } } //Log.info(wrapper); return wrapper; }, + + getHeader: function () { + if (this.warnings.length < 1 && this.config.hideNoWarning) { + if (this.data.header) return ""; + else return ""; + } else { + return this.data.header; + } + }, wordwrap: function (str, width, brk) { From 84f9fcf8b8279ab5f3b888d17dfcd11df49d7153 Mon Sep 17 00:00:00 2001 From: Krouty Date: Tue, 23 Nov 2021 15:03:24 +0100 Subject: [PATCH 2/2] fix displaying header when no warnings available Fixing an error for #29 where the header of the module was hidden even if there was a weather warning. --- MMM-DWD-WarnWeather.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MMM-DWD-WarnWeather.js b/MMM-DWD-WarnWeather.js index e3bb37e..3ba7be2 100644 --- a/MMM-DWD-WarnWeather.js +++ b/MMM-DWD-WarnWeather.js @@ -163,7 +163,8 @@ Module.register("MMM-DWD-WarnWeather", { var duration = document.createElement("div"); duration.className = 'duration'; duration.innerHTML = start + ' - ' + end; - var newLine = document.createElement("br"); + var newLine1 = document.createElement("br"); + var newLine2 = document.createElement("br"); description.appendChild(headline); description.appendChild(duration); warnWrapper.appendChild(icon);