diff --git a/scraper/internal/server/ui.go b/scraper/internal/server/ui.go index 8c9fa66..556736c 100644 --- a/scraper/internal/server/ui.go +++ b/scraper/internal/server/ui.go @@ -2310,19 +2310,17 @@ const chapterTmpl = ` -
-
- Ch. {{.ChapterN}} - idle - - -
+
+ Ch. {{.ChapterN}} + idle + +
@@ -2597,6 +2595,8 @@ const chapterTmpl = ` } // ── UI state helpers ────────────────────────────────────────────────────── + var SVG_PLAY = ''; + var SVG_PAUSE = ''; function setPlayIcon(icon) { playerPlayIcon.innerHTML = icon; } function setGenerating() { @@ -2610,11 +2610,13 @@ const chapterTmpl = ` } function setPlaying() { if (stale()) return; - setPlayIcon('▮▮'); + setPlayIcon(SVG_PAUSE); playerPlayBtn.disabled = false; voiceSel.disabled = false; speedSlider.disabled = false; setBadge(playerStateBadge, 'playing'); - playerStateBadge.textContent = '0%'; + var pct = (audio.duration && isFinite(audio.duration)) + ? Math.round((audio.currentTime / audio.duration) * 100) : 0; + playerStateBadge.textContent = pct + '%'; playerTitle.textContent = 'Ch.\u00a0' + CHAPTER_N; setStatus(''); showSeek(); @@ -2622,7 +2624,7 @@ const chapterTmpl = ` } function setPaused() { if (stale()) return; - setPlayIcon('▶'); + setPlayIcon(SVG_PLAY); setBadge(playerStateBadge, 'paused'); var pct = (audio.duration && isFinite(audio.duration)) ? Math.round((audio.currentTime / audio.duration) * 100) : 0; @@ -2633,7 +2635,7 @@ const chapterTmpl = ` } function setStopped() { highlightPara(-1); - setPlayIcon('▶'); + setPlayIcon(SVG_PLAY); playerPlayBtn.disabled = false; voiceSel.disabled = false; speedSlider.disabled = false; setBadge(playerStateBadge, 'idle'); @@ -2651,7 +2653,7 @@ const chapterTmpl = ` function setError(msg) { if (stale()) return; highlightPara(-1); - setPlayIcon('▶'); + setPlayIcon(SVG_PLAY); playerPlayBtn.disabled = false; voiceSel.disabled = false; speedSlider.disabled = false; setBadge(playerStateBadge, 'error');