diff --git a/CHANGELOG.md b/CHANGELOG.md index 77936100..6a7705e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ _This release is scheduled to be released on 2020-07-01._ - Added prettier for an even cleaner codebase +- Hide Sunrise/Sunset in Weather module + ### Updated - Cleaned up alert module code @@ -23,6 +25,7 @@ _This release is scheduled to be released on 2020-07-01._ - Switch to most of the eslint:recommended rules and fix warnings - Replaced insecure links with https ones - Cleaned up all "no-undef" warnings from eslint +- Added location title wrapping for calendar module ### Deleted @@ -33,6 +36,7 @@ _This release is scheduled to be released on 2020-07-01._ - The broken modules due to Socket.io change from last release [#1973](https://github.com/MichMich/MagicMirror/issues/1973) - Add backward compatibility for old module code in socketclient.js [#1973](https://github.com/MichMich/MagicMirror/issues/1973) - Support multiple instances of calendar module with different config [#1109](https://github.com/MichMich/MagicMirror/issues/1109) +- Fix the use of "maxNumberOfDays" in the module "weatherforecast" [#2018](https://github.com/MichMich/MagicMirror/issues/2018) ## [2.11.0] - 2020-04-01 diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 4d4b57f7..3658e1e6 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -17,8 +17,11 @@ Module.register("calendar", { displayRepeatingCountTitle: false, defaultRepeatingCountTitle: "", maxTitleLength: 25, + maxLocationTitleLength: 25, wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength + wrapLocationEvents: false, maxTitleLines: 3, + maxEventTitleLines: 3, fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. animationSpeed: 2000, fade: true, @@ -45,6 +48,9 @@ Module.register("calendar", { "De verjaardag van ": "", "'s birthday": "" }, + locationTitleReplace: { + "street ": "" + }, broadcastEvents: true, excludedEvents: [], sliceMultiDayEvents: false, @@ -245,7 +251,7 @@ Module.register("calendar", { } } - titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle; + titleWrapper.innerHTML = this.titleTransform(event.title, this.config.titleReplace, this.config.wrapEvents, this.config.maxTitleLength, this.config.maxTitleLines) + repeatingCountTitle; var titleClass = this.titleClassForUrl(event.url); @@ -393,7 +399,7 @@ Module.register("calendar", { var descCell = document.createElement("td"); descCell.className = "location"; descCell.colSpan = "2"; - descCell.innerHTML = event.location; + descCell.innerHTML = this.titleTransform(event.location, this.config.locationTitleReplace, this.config.wrapLocationEvents, this.config.maxLocationTitleLength, this.config.maxEventTitleLines); locationRow.appendChild(descCell); wrapper.appendChild(locationRow); @@ -724,9 +730,9 @@ Module.register("calendar", { * * return string - The transformed title. */ - titleTransform: function (title) { - for (var needle in this.config.titleReplace) { - var replacement = this.config.titleReplace[needle]; + titleTransform: function (title, titleReplace, wrapEvents, maxTitleLength, maxTitleLines) { + for (var needle in titleReplace) { + var replacement = titleReplace[needle]; var regParts = needle.match(/^\/(.+)\/([gim]*)$/); if (regParts) { @@ -737,7 +743,7 @@ Module.register("calendar", { title = title.replace(needle, replacement); } - title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents, this.config.maxTitleLines); + title = this.shorten(title, maxTitleLength, wrapEvents, maxTitleLines); return title; }, diff --git a/modules/default/weather/current.njk b/modules/default/weather/current.njk index 33dac07a..d89c5f53 100755 --- a/modules/default/weather/current.njk +++ b/modules/default/weather/current.njk @@ -22,14 +22,16 @@ {% if config.showHumidity and current.humidity %} {{ current.humidity | decimalSymbol }}  {% endif %} - - - {% if current.nextSunAction() === "sunset" %} - {{ current.sunset | formatTime }} - {% else %} - {{ current.sunrise | formatTime }} - {% endif %} - + {% if config.showSun %} + + + {% if current.nextSunAction() === "sunset" %} + {{ current.sunset | formatTime }} + {% else %} + {{ current.sunrise | formatTime }} + {% endif %} + + {% endif %} {% endif %}
diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index b7ddd0c9..23afb549 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -31,6 +31,7 @@ Module.register("weather", { useBeaufort: true, lang: config.language, showHumidity: false, + showSun: true, degreeLabel: false, decimalSymbol: ".", showIndoorTemperature: false, diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 8846289e..83389911 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -294,6 +294,8 @@ Module.register("weatherforecast", { return; } + params += "&cnt=" + (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays); + params += "&units=" + this.config.units; params += "&lang=" + this.config.lang; params += "&APPID=" + this.config.appid; diff --git a/tests/configs/modules/weather/currentweather_options.js b/tests/configs/modules/weather/currentweather_options.js index 2b5f9774..3c9021f5 100644 --- a/tests/configs/modules/weather/currentweather_options.js +++ b/tests/configs/modules/weather/currentweather_options.js @@ -28,6 +28,7 @@ let config = { initialLoadDelay: 3000, useBeaufort: false, showWindDirectionAsArrow: true, + showSun: false, showHumidity: true, roundTemp: true, degreeLabel: true