mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Perform customEvent symbols replacement in symbolsForEvent
This commit is contained in:
parent
512c392386
commit
c579989ded
@ -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