diff --git a/index.html b/index.html index 8ed9b51..3e77eb5 100644 --- a/index.html +++ b/index.html @@ -65,6 +65,7 @@ .legend span::before { content: ""; display: block; width: 14px; height: 6px; border-radius: 2px; } .legend .rec::before { background: var(--accent); } .legend .gap::before { background: #2a2a2a; border: 1px solid #444; } + .legend .highlight::before { background: #ffd43b; } .highlights { margin-top: 18px; background: var(--surface); border-radius: 8px; padding: 14px 16px; } .highlights h2 { font-size: 14px; font-weight: 500; margin-bottom: 10px; } .highlight-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } @@ -159,7 +160,7 @@
-
RecordedNo recording
+
RecordedHighlightNo recording
@@ -196,6 +197,7 @@ let initialOffset = 0; let zoom = 1; let focus = 43200; + let highlights = []; let highlightStart = null; let highlightEnd = null; let encodingWasRunning = false; @@ -286,7 +288,9 @@ } async function loadHighlights() { const response = await fetch("/api/highlights"); - const items = (await response.json()).filter(item => item.date === dateSelect.value); + highlights = (await response.json()).filter(item => item.date === dateSelect.value); + const items = highlights; + drawTimeline(); const list = document.querySelector("#highlight-list"); list.replaceChildren(); if (!items.length) { @@ -388,6 +392,12 @@ const r = ((i + 1) * 60 - winStart) / winSize * w; if (r > 0 && l < w) ctx.fillRect(Math.max(0, l), 0, Math.min(w, r) - Math.max(0, l), 56); }); + ctx.fillStyle = "#ffd43b"; + highlights.forEach(item => { + const l = (item.start - winStart) / winSize * w; + const r = (item.end - winStart) / winSize * w; + if (r > 0 && l < w) ctx.fillRect(Math.max(0, l), 0, Math.min(w, r) - Math.max(0, l), 56); + }); // hour lines ctx.strokeStyle = "rgba(255,255,255,.08)"; for (let h = Math.ceil(winStart / 3600); h < winEnd / 3600; h++) {