-
Is it possible to do this? The first one, the M have the end time 9 and the N have the start time 10, but IRL it does'nt look like this. I've made the picture in photoshop. The second one, can I change something to always put this event in the bottom of the calendar? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
![]()
Very challenging question. To place the top position, you can use eventSorter: (a, b) => {
if (a.calendarName === 'ManU') return -1
}, For example, By this custom function, if the events from But placing the last position with empty lines? Well, this module is not designed so. This module cannot do that by itself.
You need {
module: "MMM-ModuleMonkeyPatch",
config: {
patches: [
{
module: "MMM-CalendarExt3",
method: "getDom",
patch: function (original, args) {
let dom = original(args)
let target = Array.from(dom.querySelectorAll('.event')) || []
target.forEach((e) => {
if (e.dataset.calendarName === 'ManU') { // If calendar name is "ManU", put that event to cellFooter area.
const dt = new Date(+e.dataset.startDate)
const date = '.date_' + dt.getDate()
const month = '.month_' + (dt.getMonth() + 1)
const container = dom.querySelector(`.cell${date + month} .cellFooter`)
if (container) container.appendChild(e)
}
})
return dom
}
}
]
}
}, And some CSS tweek. (in .CX3 {
--cellfooterheight: 25px;
}
.CX3 .cell {
overflow: hidden;
}
.CX3 .cellFooter {
overflow: hidden;
} This example doesn't regard error exceptions. Just show you it is possible. |
Beta Was this translation helpful? Give feedback.
-
Conditions
Configuration// In config of module CX3
manipulateDateCell: (cell, events) => {
if (cell.dataset.events < 1) return
const cellDate = new Date(+cell.dataset.date)
const date = cellDate.getDate()
events.forEach((event) => {
const keyMap = {
'a' : 'TurnA', // 'TurnA' is the part of event title to target, 'a' is the class name to assign
'b' : 'TurnB',
}
if (!Object.values(keyMap).some((name) => { return event.title.includes(name) })) return
for (const [ classKey, searchTitle ] of Object.entries(keyMap)) {
if (event.title.includes(searchTitle)) {
cell.classList.add(classKey)
if (date === (new Date(+event.startDate)).getDate()) cell.classList.add(classKey + '-start')
if (date === (new Date(+event.endDate)).getDate()) cell.classList.add(classKey + '-end')
}
}
})
} To adjust to your case, modify CSS.CX3 {
--color-a: rgb(255 200 200 / 50%);
--color-b: rgb(200 200 255 / 50%);
}
.CX3 .cell.a {
background-color: var(--color-a);
}
.CX3 .cell.b {
background-color: var(--color-b);
}
.CX3 .cell.a-start.b-end {
background: linear-gradient(110deg, var(--color-b) 40%, var(--color-a) 40%);
}
.CX3 .cell.b-start.a-end {
background: linear-gradient(110deg, var(--color-a) 40%, var(--color-b) 40%);
} |
Beta Was this translation helpful? Give feedback.
-
I did got the monkeymodule right after a while. I did remove the CSS and copy paste back step by step. But then, I made a mistake again and the view went almost like this. AND I LOVE IT. Thank you for giving me this. The first idea was to have another calendar in the monkeymodule, but this went better than that! I really appreciate it. Simple, nice view. |
Beta Was this translation helpful? Give feedback.
Conditions
TurnA
andTurnB
, (no TurnC or other else)TurnA
andTurnB
. e.g.BlahBlahTurnABlah
will be regarded asTurnA
. Butturn A
will not be recognized.TurnA and TurnB
will also be problem, so keep the rule.Configuration