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
- 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

View File

@ -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;
},

View File

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

View File

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

View File

@ -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;

View File

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