add line for curent time (#4)
This commit is contained in:
@@ -102,11 +102,9 @@
|
||||
width: 100%;
|
||||
background-color: var(--color-base-30);
|
||||
}
|
||||
.frcal__day:nth-child(odd) .frcal__hourline {
|
||||
/* background-color: var(--background-primary); */
|
||||
}
|
||||
.frcal__day:nth-child(even) .frcal__hourline {
|
||||
/* background-color: var(--background-primary-alt); */
|
||||
.frcal__hourline.frcal__now {
|
||||
background-color: var(--color-accent);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.frcal__event span {
|
||||
|
||||
27
main.js
27
main.js
@@ -469,7 +469,7 @@ class CalendarView extends ItemView
|
||||
this.updateWeek();
|
||||
}
|
||||
|
||||
gotoThisWeek(week = '')
|
||||
gotoThisWeek(week = '')
|
||||
{
|
||||
if (week == '')
|
||||
{
|
||||
@@ -499,7 +499,7 @@ class CalendarView extends ItemView
|
||||
if (monthF != monthS)
|
||||
{
|
||||
this.mountSecondSpanEl.innerText = (monthS+1).toString() + " - " + DateFormat.months[monthS];
|
||||
|
||||
|
||||
let dow = zoDate.date();
|
||||
|
||||
this.mountFirstEl.setAttr("style", "flex: " + ((7-dow)*10).toString());
|
||||
@@ -512,11 +512,19 @@ class CalendarView extends ItemView
|
||||
this.mountSecondEl.setAttr("style", "flex: 0")
|
||||
}
|
||||
|
||||
|
||||
let today = parseSingleDate("12:00pm", moment());
|
||||
for (let day = 0; day < 7; day++)
|
||||
{
|
||||
let date = parseSingleDate(this.week + " " + DateFormat.days[(day + 1) % 7] + " 12:00pm");
|
||||
this.dayHeads[day].innerHTML = DateFormat.daysLong[day] + "<br/>" + date.date().toString();
|
||||
if (date.diff(today, "minutes") == 0)
|
||||
{
|
||||
this.dayHeads[day].style.color = "var(--color-accent)";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dayHeads[day].style.color = "";
|
||||
}
|
||||
}
|
||||
|
||||
this.updateEvents();
|
||||
@@ -533,17 +541,28 @@ class CalendarView extends ItemView
|
||||
// "location": null,
|
||||
// "state": "reminder"
|
||||
// };
|
||||
|
||||
|
||||
// clear events
|
||||
let today = parseSingleDate("12:00pm", moment());
|
||||
for (let day = 0; day < 7; day++)
|
||||
{
|
||||
this.allday[day].innerHTML = "";
|
||||
this.timed[day].innerHTML = "";
|
||||
// add hour lines
|
||||
let hourlinesEl = this.timed[day].createEl("div", { cls: "frcal__hourlines" });
|
||||
hourlinesEl.createEl("div", { cls: "frcal__hourline", attr: { style: "margin-top: 0px"} })
|
||||
for (let hour = 0; hour < 11; hour++)
|
||||
{
|
||||
hourlinesEl.createEl("div", { cls: "frcal__hourline", attr: { style: "margin-top: " + (120*this.zoom-1).toString() + "px"} })
|
||||
}
|
||||
// add current time line
|
||||
if (parseSingleDate(this.week + " " + DateFormat.days[(day+1) % 7] + " 12:00pm").diff(today, "minutes") == 0)
|
||||
{
|
||||
let time = moment();
|
||||
time = time.hour()*60 + time.minute();
|
||||
this.timed[day].createEl("div", { cls: "frcal__hourlines" })
|
||||
.createEl("div", { cls: "frcal__hourline frcal__now", attr: { style: "top: " + (time*this.zoom-1).toString() + "px"} })
|
||||
}
|
||||
}
|
||||
|
||||
let start = parseSingleDate(this.week + " ma 00:00am");
|
||||
|
||||
Reference in New Issue
Block a user