From bb89b434edc9dd497691f51d7f8da8a2a64b22c5 Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Mon, 17 Aug 2026 01:07:38 +0200 Subject: [PATCH] Error fixing and debugging implementation. --- Web/templates/library_table.html | 47 ++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/Web/templates/library_table.html b/Web/templates/library_table.html index 1fc5764..6e8a6b2 100644 --- a/Web/templates/library_table.html +++ b/Web/templates/library_table.html @@ -1359,9 +1359,11 @@ const detailContent = document.getElementById('detailContent'); const detailModal = document.getElementById('detailModal'); + // Lade-Status anzeigen und Modal öffnen detailContent.innerHTML = '

Lade Details...

'; detailModal.style.display = 'flex'; + // Daten vom Backend-API-Endpoint abrufen fetch(`/api/item_detail/${itemId}`) .then(response => { if (!response.ok) { @@ -1373,23 +1375,40 @@ detailContent.innerHTML = data.html; const imageArray = data.images || []; + const thumbnailInfoMap = data.thumbnailInfo || []; if (Array.isArray(imageArray) && imageArray.length > 0) { - const imagesHtml = imageArray.map(image => { - const imageSrc = image.startsWith('/uploads/') || image.startsWith('http') - ? image - : `/uploads/${image}`; + const imagesHtml = imageArray.map((image, index) => { + const isVideo = typeof isVideoFile === 'function' ? isVideoFile(image) : /\.(mp4|webm|ogg|mov)$/i.test(image); + const thumbnailInfo = thumbnailInfoMap[index]; - return ` -
- Buchcover -
- `; + if (isVideo) { + const videoSrc = image.startsWith('/uploads/') || image.startsWith('http') + ? image + : `/uploads/${image}`; + + return ` +
+ +
`; + } else { + const imageSrc = thumbnailInfo && thumbnailInfo.has_preview + ? thumbnailInfo.preview_url + : (image.startsWith('/uploads/') || image.startsWith('http') + ? image + : `/uploads/${image}`); + + return ` +
+ Buchcover / Bild +
`; + } }).join(''); const mediaHtml = ``;