Merge branch 'develop' into develop

This commit is contained in:
Michael Teeuw 2020-06-02 09:17:43 +02:00 committed by GitHub
commit 4d21f8d022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 14 deletions

View File

@ -15,6 +15,8 @@ _This release is scheduled to be released on 2020-07-01._
- Added prettier for an even cleaner codebase - Added prettier for an even cleaner codebase
- Hide Sunrise/Sunset in Weather module
### Updated ### Updated
- Cleaned up alert module code - 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 - Switch to most of the eslint:recommended rules and fix warnings
- Replaced insecure links with https ones - Replaced insecure links with https ones
- Cleaned up all "no-undef" warnings from eslint - Cleaned up all "no-undef" warnings from eslint
- Added location title wrapping for calendar module
### Deleted ### 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) - 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) - 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) - 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 ## [2.11.0] - 2020-04-01

View File

@ -17,8 +17,11 @@ Module.register("calendar", {
displayRepeatingCountTitle: false, displayRepeatingCountTitle: false,
defaultRepeatingCountTitle: "", defaultRepeatingCountTitle: "",
maxTitleLength: 25, maxTitleLength: 25,
maxLocationTitleLength: 25,
wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength
wrapLocationEvents: false,
maxTitleLines: 3, maxTitleLines: 3,
maxEventTitleLines: 3,
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
animationSpeed: 2000, animationSpeed: 2000,
fade: true, fade: true,
@ -45,6 +48,9 @@ Module.register("calendar", {
"De verjaardag van ": "", "De verjaardag van ": "",
"'s birthday": "" "'s birthday": ""
}, },
locationTitleReplace: {
"street ": ""
},
broadcastEvents: true, broadcastEvents: true,
excludedEvents: [], excludedEvents: [],
sliceMultiDayEvents: false, 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); var titleClass = this.titleClassForUrl(event.url);
@ -393,7 +399,7 @@ Module.register("calendar", {
var descCell = document.createElement("td"); var descCell = document.createElement("td");
descCell.className = "location"; descCell.className = "location";
descCell.colSpan = "2"; 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); locationRow.appendChild(descCell);
wrapper.appendChild(locationRow); wrapper.appendChild(locationRow);
@ -724,9 +730,9 @@ Module.register("calendar", {
* *
* return string - The transformed title. * return string - The transformed title.
*/ */
titleTransform: function (title) { titleTransform: function (title, titleReplace, wrapEvents, maxTitleLength, maxTitleLines) {
for (var needle in this.config.titleReplace) { for (var needle in titleReplace) {
var replacement = this.config.titleReplace[needle]; var replacement = titleReplace[needle];
var regParts = needle.match(/^\/(.+)\/([gim]*)$/); var regParts = needle.match(/^\/(.+)\/([gim]*)$/);
if (regParts) { if (regParts) {
@ -737,7 +743,7 @@ Module.register("calendar", {
title = title.replace(needle, replacement); 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; return title;
}, },

View File

@ -22,6 +22,7 @@
{% if config.showHumidity and current.humidity %} {% if config.showHumidity and current.humidity %}
<span>{{ current.humidity | decimalSymbol }}</span><sup>&nbsp;<i class="wi wi-humidity humidityIcon"></i></sup> <span>{{ current.humidity | decimalSymbol }}</span><sup>&nbsp;<i class="wi wi-humidity humidityIcon"></i></sup>
{% endif %} {% endif %}
{% if config.showSun %}
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span> <span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
<span> <span>
{% if current.nextSunAction() === "sunset" %} {% if current.nextSunAction() === "sunset" %}
@ -30,6 +31,7 @@
{{ current.sunrise | formatTime }} {{ current.sunrise | formatTime }}
{% endif %} {% endif %}
</span> </span>
{% endif %}
</div> </div>
{% endif %} {% endif %}
<div class="large light"> <div class="large light">

View File

@ -31,6 +31,7 @@ Module.register("weather", {
useBeaufort: true, useBeaufort: true,
lang: config.language, lang: config.language,
showHumidity: false, showHumidity: false,
showSun: true,
degreeLabel: false, degreeLabel: false,
decimalSymbol: ".", decimalSymbol: ".",
showIndoorTemperature: false, showIndoorTemperature: false,

View File

@ -294,6 +294,8 @@ Module.register("weatherforecast", {
return; return;
} }
params += "&cnt=" + (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays);
params += "&units=" + this.config.units; params += "&units=" + this.config.units;
params += "&lang=" + this.config.lang; params += "&lang=" + this.config.lang;
params += "&APPID=" + this.config.appid; params += "&APPID=" + this.config.appid;

View File

@ -28,6 +28,7 @@ let config = {
initialLoadDelay: 3000, initialLoadDelay: 3000,
useBeaufort: false, useBeaufort: false,
showWindDirectionAsArrow: true, showWindDirectionAsArrow: true,
showSun: false,
showHumidity: true, showHumidity: true,
roundTemp: true, roundTemp: true,
degreeLabel: true degreeLabel: true