diff --git a/static/app.js b/static/app.js index 1032f93..6b5943b 100644 --- a/static/app.js +++ b/static/app.js @@ -4,44 +4,6 @@ let currentMusicIndex = -1; // Index of the current music file let currentTrackPath = ""; let activeTranscriptAudio = ""; // Audio file that matches the currently open transcript. -// Check thumb availability in parallel; sequentially generate missing ones to avoid concurrent creation. -function ensureFirstFivePreviews() { - const images = Array.from(document.querySelectorAll('.images-grid img')).slice(0, 5); - if (!images.length) return; - - const checks = images.map(img => { - const thumbUrl = img.dataset.thumbUrl || img.src; - const fullUrl = img.dataset.fullUrl; - return fetch(thumbUrl, { method: 'GET', cache: 'no-store' }) - .then(res => ({ - img, - thumbUrl, - fullUrl, - hasThumb: res.ok && res.status !== 204 - })) - .catch(() => ({ img, thumbUrl, fullUrl, hasThumb: false })); - }); - - Promise.all(checks).then(results => { - const missing = results.filter(r => !r.hasThumb && r.fullUrl); - if (!missing.length) return; - generateThumbsSequentially(missing); - }); -} - -async function generateThumbsSequentially(entries) { - for (const { img, thumbUrl, fullUrl } of entries) { - try { - await fetch(fullUrl, { method: 'GET', cache: 'no-store' }); - const cacheBust = `_=${Date.now()}`; - const separator = thumbUrl.includes('?') ? '&' : '?'; - img.src = `${thumbUrl}${separator}${cacheBust}`; - } catch (e) { - // ignore; best effort - } - } -} - function getMainContainer() { return document.querySelector('main'); } @@ -437,7 +399,6 @@ function renderContent(data) { // Update gallery images for lightbox or similar currentGalleryImages = imageFiles.map(f => f.path); - ensureFirstFivePreviews(); attachEventListeners(); }