fix timed event pos and add week num
This commit is contained in:
parent
66ce7ddfbf
commit
82da2b05cf
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
data.json
|
||||
@ -90,7 +90,17 @@
|
||||
.frcal__event span {
|
||||
background-color: var(--color-accent);
|
||||
border-radius: 5px;
|
||||
min-height: inherit;
|
||||
padding: 5px;
|
||||
margin: 5px 3px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.frcal__timed_item .frcal__event {
|
||||
position: relative;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.frcal__timed_item .frcal__event span {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
25
main.js
25
main.js
@ -125,7 +125,7 @@ function scanFile(editor, data)
|
||||
{
|
||||
let res, line = editor.getLine(lineNum);
|
||||
|
||||
res = line.match("weekboek: (" + DateFormat.date + ")");
|
||||
res = line.match("weekboek: \"?(" + DateFormat.date + ")\"?");
|
||||
if (res != null)
|
||||
{
|
||||
defal = parseSingleDate(res[1], defal);
|
||||
@ -267,7 +267,8 @@ class CalendarView extends ItemView
|
||||
{
|
||||
super(leaf);
|
||||
this.plugin = plugin;
|
||||
this.week = stringifySingleDate(moment()).match(DateFormat.week)[0]
|
||||
this.week = stringifySingleDate(moment()).match(DateFormat.week)[0];
|
||||
this.zoom = 30/60; // in px/min
|
||||
}
|
||||
|
||||
getViewType()
|
||||
@ -284,6 +285,7 @@ class CalendarView extends ItemView
|
||||
{
|
||||
const container = this.containerEl.children[1];
|
||||
container.empty();
|
||||
this.eventsEls = {};
|
||||
|
||||
// month
|
||||
this.monthEl = container.createEl("div", { cls: "frcal__month" });
|
||||
@ -297,7 +299,7 @@ class CalendarView extends ItemView
|
||||
// day header
|
||||
this.headEl = container.createEl("div", { cls: "frcal__days frcal__day_head" });
|
||||
|
||||
this.headEl.createEl("div", { cls: "frcal__time" });
|
||||
this.weekNumEl = this.headEl.createEl("div", { cls: "frcal__time" });
|
||||
this.dayHeads = [null, null, null, null, null, null, null];
|
||||
for (let i = 0; i < 7; i++)
|
||||
{
|
||||
@ -371,6 +373,8 @@ class CalendarView extends ItemView
|
||||
let monthF = parseSingleDate(this.week + " ma 00:00am",).month();
|
||||
this.mountFirstSpanEl.innerText = (monthF+1).toString() + " - " + months[monthF];
|
||||
|
||||
this.weekNumEl.innerText = this.week.match(/[0-9]+$/)[0];
|
||||
|
||||
let zoDate = parseSingleDate(this.week + " zo 00:00am");
|
||||
let monthS = zoDate.month();
|
||||
if (monthF != monthS)
|
||||
@ -446,15 +450,26 @@ class CalendarView extends ItemView
|
||||
|
||||
renderEvent(event, container)
|
||||
{
|
||||
let time = parseDate(event.date);
|
||||
time[0] = time[0].hour()*60 + time[0].minute();
|
||||
time[1] = time[1].hour()*60 + time[1].minute();
|
||||
let el = container.createEl('div', {
|
||||
cls: 'frcal__event',
|
||||
id: "fr_event_" + event.id,
|
||||
attr: {
|
||||
'data-group': event.group,
|
||||
'date-state': event.state
|
||||
'data-state': event.state,
|
||||
'data-start': time[0].toString(),
|
||||
'data-duration': (time[1] - time[0]).toString(),
|
||||
'style': 'top:' + (time[0]*this.zoom).toString() + 'px'
|
||||
},
|
||||
});
|
||||
el.createEl('span', {
|
||||
text: event.title,
|
||||
attr: {
|
||||
'style': 'min-height:' + ((time[1] - time[0]) * this.zoom).toString() + 'px'
|
||||
}
|
||||
});
|
||||
el.createEl('span', { text: event.title });
|
||||
return el;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user