Zeitplan: Linie für die aktuelle Uhrzeit im heutigen Tag
This commit is contained in:
1 parent
94e1ad94e8
commit
9fdcb888aa
3 files changed
+35
No files matched your search
@@ -246,6 +246,10 @@ input[type=date].field, input[type=time].field, input[type=datetime-local].field
|
||||
/* Ein Feld über zwei Spalten, sobald es zwei gibt */
|
||||
@media (min-width: 560px) { .fields .wide { grid-column: span 2; } }
|
||||
|
||||
/* Linie für die aktuelle Uhrzeit im Kalender */
|
||||
.cal-now { position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none; border-top: 2px solid var(--bad); }
|
||||
.cal-now span { position: absolute; left: 3px; top: -8px; padding: 0 3px; border-radius: 4px; background: var(--bad); color: #1c1310; font: 10px var(--mono); }
|
||||
|
||||
/* Zeitraum im Kalender aufziehen */
|
||||
.cal-col { cursor: crosshair; touch-action: none; user-select: none; }
|
||||
.cal-sel { position: absolute; left: 2px; right: 2px; border: 1px dashed var(--accent); border-radius: 6px; background: var(--accent-bg); color: var(--accent-text); font: 11px var(--mono); padding: 3px 5px; pointer-events: none; z-index: 2; }
|
||||
|
||||
@@ -1463,6 +1463,21 @@ async function schedulePage() {
|
||||
h('span', { class: 'ev-kind' }, KIND_LABEL[e.kind.kind]), h('span', { class: 'mono' }, e.subject),
|
||||
e.note ? h('span', {}, e.note) : null, h('span', { class: 'ev-by' }, 'von ' + creator(e)), h('span', { class: 'mono' }, hhmm(from) + '–' + (to.getTime() === dayStart.getTime() + 86400000 ? '24:00' : hhmm(to)))));
|
||||
}
|
||||
// Linie für die aktuelle Uhrzeit im heutigen Tag, hält sich alle 30 Sekunden aktuell
|
||||
if (dayStart.toDateString() === new Date().toDateString()) {
|
||||
const line = h('div', { class: 'cal-now' }, h('span', {}));
|
||||
const place = () => {
|
||||
const now = new Date();
|
||||
line.style.top = ((now.getHours() * 60 + now.getMinutes()) / 60 * HOUR) + 'px';
|
||||
line.firstChild.textContent = hhmm(now);
|
||||
};
|
||||
place();
|
||||
const tick = setInterval(() => {
|
||||
if (!col.isConnected) return clearInterval(tick);
|
||||
place();
|
||||
}, 30000);
|
||||
col.append(line);
|
||||
}
|
||||
// Minuten seit Tagesbeginn an der Zeigerposition, auf halbe Stunden gerastert
|
||||
const minutes = (ev, round) => {
|
||||
const y = ev.clientY - col.getBoundingClientRect().top;
|
||||
|
||||
Reference in new issue
Block a user