mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
Merge pull request #2754 from kolbyjack/broadcast-custom-symbols
This commit is contained in:
commit
7a7ed48063
@ -44,6 +44,7 @@ _This release is scheduled to be released on 2022-01-01._
|
|||||||
- Fixed Calendar recurring cross timezone error (add/subtract a day, not just offset hours) (#2632)
|
- Fixed Calendar recurring cross timezone error (add/subtract a day, not just offset hours) (#2632)
|
||||||
- Fixed Calendar showEnd and Full Date overlay (#2629)
|
- Fixed Calendar showEnd and Full Date overlay (#2629)
|
||||||
- Fixed regression on #2632, #2752
|
- Fixed regression on #2632, #2752
|
||||||
|
- Broadcast custom symbols in CALENDAR_EVENTS
|
||||||
|
|
||||||
## [2.17.1] - 2021-10-01
|
## [2.17.1] - 2021-10-01
|
||||||
|
|
||||||
|
@ -237,18 +237,6 @@ Module.register("calendar", {
|
|||||||
symbolWrapper.className = "symbol align-right " + symbolClass;
|
symbolWrapper.className = "symbol align-right " + symbolClass;
|
||||||
|
|
||||||
const symbols = this.symbolsForEvent(event);
|
const symbols = this.symbolsForEvent(event);
|
||||||
// If symbols are displayed and custom symbol is set, replace event symbol
|
|
||||||
if (this.config.displaySymbol && this.config.customEvents.length > 0) {
|
|
||||||
for (let ev in this.config.customEvents) {
|
|
||||||
if (typeof this.config.customEvents[ev].symbol !== "undefined" && this.config.customEvents[ev].symbol !== "") {
|
|
||||||
let needle = new RegExp(this.config.customEvents[ev].keyword, "gi");
|
|
||||||
if (needle.test(event.title)) {
|
|
||||||
symbols[0] = this.config.customEvents[ev].symbol;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
symbols.forEach((s, index) => {
|
symbols.forEach((s, index) => {
|
||||||
const symbol = document.createElement("span");
|
const symbol = document.createElement("span");
|
||||||
symbol.className = "fa fa-fw fa-" + s;
|
symbol.className = "fa fa-fw fa-" + s;
|
||||||
@ -640,6 +628,17 @@ Module.register("calendar", {
|
|||||||
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
|
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If custom symbol is set, replace event symbol
|
||||||
|
for (let ev of this.config.customEvents) {
|
||||||
|
if (typeof ev.symbol !== "undefined" && ev.symbol !== "") {
|
||||||
|
let needle = new RegExp(ev.keyword, "gi");
|
||||||
|
if (needle.test(event.title)) {
|
||||||
|
symbols[0] = ev.symbol;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return symbols;
|
return symbols;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user