mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 05:07:05 +00:00
Update compliments module (#3471)
`Fixes #3465` Add config option `specialDayUnique` that defaults to `false` and causes special day compliments to be added to the existing compliments array. Setting this option to `true` will only show the compliments that have been configured for that day. --------- Co-authored-by: Veeck <github@veeck.de> Co-authored-by: veeck <michael.veeck@nebenan.de> Co-authored-by: Karsten Hassel <hassel@gmx.de>
This commit is contained in:
@@ -15,7 +15,8 @@ Module.register("compliments", {
|
||||
morningEndTime: 12,
|
||||
afternoonStartTime: 12,
|
||||
afternoonEndTime: 17,
|
||||
random: true
|
||||
random: true,
|
||||
specialDayUnique: false
|
||||
},
|
||||
lastIndexUsed: -1,
|
||||
// Set currentweather from module
|
||||
@@ -98,6 +99,10 @@ Module.register("compliments", {
|
||||
// Add compliments for special days
|
||||
for (let entry in this.config.compliments) {
|
||||
if (new RegExp(entry).test(date)) {
|
||||
// Only display compliments configured for the day if specialDayUnique is set to true
|
||||
if (this.config.specialDayUnique) {
|
||||
compliments.length = 0;
|
||||
}
|
||||
Array.prototype.push.apply(compliments, this.config.compliments[entry]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user