add basic suport for concurrent events (#6)
This commit is contained in:
parent
0c5f577464
commit
7b36ee9094
@ -116,6 +116,12 @@
|
||||
margin: 5px 3px;
|
||||
display: block;
|
||||
}
|
||||
.frcal__event.frcal__event_concurrent1 span {
|
||||
width: 50%;
|
||||
}
|
||||
.frcal__event.frcal__event_concurrent2 {
|
||||
padding-left: 50%;
|
||||
}
|
||||
|
||||
.frcal__timed_item .frcal__event {
|
||||
position: relative;
|
||||
|
||||
33
main.js
33
main.js
@ -631,15 +631,42 @@ class CalendarView extends ItemView
|
||||
|
||||
time[0] = time[0].hour()*60 + time[0].minute();
|
||||
time[1] = time[1].hour()*60 + time[1].minute();
|
||||
|
||||
// check for concurrent events
|
||||
let classes = "frcal__event";
|
||||
for (let i in container.children)
|
||||
{
|
||||
let child = container.children[i];
|
||||
if ((child instanceof HTMLElement) && child.hasClass("frcal__event"))
|
||||
{
|
||||
if (
|
||||
(time[1] > parseInt(child.dataset.start))
|
||||
&& (time[0] < parseInt(child.dataset.end))
|
||||
)
|
||||
{
|
||||
if (time[0] < parseInt(child.dataset.start))
|
||||
{
|
||||
classes += " frcal__event_concurrent1";
|
||||
child.addClass("frcal__event_concurrent2");
|
||||
}
|
||||
else
|
||||
{
|
||||
child.addClass("frcal__event_concurrent1");
|
||||
classes += " frcal__event_concurrent2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let el = container.createEl('div', {
|
||||
cls: 'frcal__event',
|
||||
id: "fr_event_" + event.id,
|
||||
cls: classes,
|
||||
attr: {
|
||||
'id': "fr_event_" + event.id,
|
||||
'data-group': event.group,
|
||||
'data-state': event.state,
|
||||
'data-type': event.type,
|
||||
'data-start': time[0].toString(),
|
||||
'data-duration': (time[1] - time[0]).toString(),
|
||||
'data-end': time[1].toString(),
|
||||
'style': ((allDay) ? '' : 'top:' + (time[0]*this.zoom).toString() + 'px')
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user