feat(video-cache): 选择视频弹窗支持定位并高亮当前项
This commit is contained in:
1 parent
7501a50194
commit
68c2cc9685
3 files changed
+40
-2
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
|
||||
<script src="/static/common/js/theme.js?v=0.1.0"></script>
|
||||
<link href="/static/common/css/common.css?v=0.3.7" rel="stylesheet">
|
||||
<link href="/static/public/css/video.css?v=0.4.11" rel="stylesheet">
|
||||
<link href="/static/public/css/video.css?v=0.4.12" rel="stylesheet">
|
||||
<link href="/static/common/css/toast.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
<script src="/static/common/js/pwa.js?v=0.1.1"></script>
|
||||
<script src="/static/vendor/ffmpeg/ffmpeg.js?v=0.1.0"></script>
|
||||
<script src="/static/vendor/ffmpeg/ffmpeg-util.js?v=0.1.0"></script>
|
||||
<script src="/static/public/js/video.js?v=0.5.28"></script>
|
||||
<script src="/static/public/js/video.js?v=0.5.29"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user