diff --git a/templates/recounting.html b/templates/recounting.html index 0859255..d74c521 100644 --- a/templates/recounting.html +++ b/templates/recounting.html @@ -502,9 +502,6 @@ function applyState(data) { loadBatchResult(data.file); } - loadFiles(); -} - // --- File list --- async function loadFiles() { @@ -535,7 +532,7 @@ async function loadFiles() { if (str) cls += ' streaming'; else if (sel) cls += ' selected'; return ` -
+
${str ? '◉' : '▶'} ${f.name} ${formatSize(f.size)} @@ -568,16 +565,27 @@ function selectFile(path, name) { document.getElementById('live-time').textContent = '--'; document.getElementById('live-status').textContent = 'no file selected'; document.getElementById('live-status').className = 'counter-status disconnected'; - loadFiles(); + updateFileSelection(); return; } selectedFile = path; document.getElementById('btn-download').disabled = false; if (!streaming) document.getElementById('btn-start').disabled = false; - loadFiles(); + updateFileSelection(); loadBatchResult(path); } +function updateFileSelection() { + document.querySelectorAll('.file-item').forEach(el => { + const path = el.getAttribute('data-path'); + if (path === selectedFile) { + el.classList.add('selected'); + } else { + el.classList.remove('selected'); + } + }); +} + let batchResultLoaded = false; async function loadBatchResult(filePath) {