From 68c2cc9685416df6c5ffab0e2ef48d4fbcc7a856 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Feb 2026 22:09:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(video-cache):=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=BC=B9=E7=AA=97=E6=94=AF=E6=8C=81=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E5=B9=B6=E9=AB=98=E4=BA=AE=E5=BD=93=E5=89=8D=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/public/css/video.css | 16 ++++++++++++++++ app/static/public/js/video.js | 22 ++++++++++++++++++++++ app/static/public/pages/video.html | 4 ++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/static/public/css/video.css b/app/static/public/css/video.css index ba1cc9a..9109461 100644 --- a/app/static/public/css/video.css +++ b/app/static/public/css/video.css @@ -818,6 +818,14 @@ html[data-theme='dark'] .cache-video-thumb-wrap { border-color: #2b3440; } +html[data-theme='dark'] .cache-video-item.is-active { + background: rgba(148, 163, 184, 0.12); +} + +html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap { + border-color: #93c5fd; +} + .cache-video-item { display: flex; align-items: center; @@ -831,6 +839,14 @@ html[data-theme='dark'] .cache-video-thumb-wrap { border-bottom: none; } +.cache-video-item.is-active { + background: rgba(17, 24, 39, 0.06); +} + +.cache-video-item.is-active .cache-video-thumb-wrap { + border-color: #111; +} + .cache-video-meta { min-width: 0; flex: 1; diff --git a/app/static/public/js/video.js b/app/static/public/js/video.js index bdbda00..1c8655e 100644 --- a/app/static/public/js/video.js +++ b/app/static/public/js/video.js @@ -1260,6 +1260,12 @@ return `${y}-${m}-${day} ${hh}:${mm}`; } + function normalizeVideoUrlForCompare(url) { + const raw = String(url || '').trim(); + if (!raw) return ''; + return raw.replace(/\/+$/, ''); + } + async function loadCachedVideos() { const authHeader = await ensurePublicKey(); if (authHeader === null) { @@ -1311,6 +1317,22 @@ } }, { once: true }); }); + const activeUrlRaw = cacheModalPickMode === 'merge_target' + ? mergeTargetVideoUrl + : selectedVideoUrl; + const activeUrl = normalizeVideoUrlForCompare(activeUrlRaw); + if (!activeUrl) return; + const rows = cacheVideoList.querySelectorAll('.cache-video-item'); + let activeRow = null; + rows.forEach((row) => { + const rowUrl = normalizeVideoUrlForCompare(row.getAttribute('data-url') || ''); + const isActive = rowUrl && rowUrl === activeUrl; + row.classList.toggle('is-active', isActive); + if (isActive) activeRow = row; + }); + if (activeRow && typeof activeRow.scrollIntoView === 'function') { + activeRow.scrollIntoView({ block: 'center', behavior: 'smooth' }); + } } function useCachedVideo(url, name) { diff --git a/app/static/public/pages/video.html b/app/static/public/pages/video.html index 3a161eb..8a1d7d0 100644 --- a/app/static/public/pages/video.html +++ b/app/static/public/pages/video.html @@ -18,7 +18,7 @@ - + @@ -318,7 +318,7 @@ - +