Compare commits
1 Commits
master
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cdcabe473 |
@ -47,7 +47,7 @@ main > * {
|
|||||||
|
|
||||||
/* Header styles */
|
/* Header styles */
|
||||||
.site-header {
|
.site-header {
|
||||||
background: linear-gradient(120deg, var(--dark-background), var(--brand-navy));
|
background: linear-gradient(120deg, var(--dark-background), #13253f);
|
||||||
color: var(--header-text-color);
|
color: var(--header-text-color);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@ -4,44 +4,6 @@ let currentMusicIndex = -1; // Index of the current music file
|
|||||||
let currentTrackPath = "";
|
let currentTrackPath = "";
|
||||||
let activeTranscriptAudio = ""; // Audio file that matches the currently open transcript.
|
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() {
|
function getMainContainer() {
|
||||||
return document.querySelector('main');
|
return document.querySelector('main');
|
||||||
}
|
}
|
||||||
@ -437,7 +399,6 @@ function renderContent(data) {
|
|||||||
|
|
||||||
// Update gallery images for lightbox or similar
|
// Update gallery images for lightbox or similar
|
||||||
currentGalleryImages = imageFiles.map(f => f.path);
|
currentGalleryImages = imageFiles.map(f => f.path);
|
||||||
ensureFirstFivePreviews();
|
|
||||||
|
|
||||||
attachEventListeners();
|
attachEventListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user