From 17b58ff7ca99b3662c749e33ac81738f654de706 Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Sat, 22 Aug 2026 00:08:38 +0200 Subject: [PATCH] Removal again --- Web/templates/upload_admin.html | 91 +++++++++++---------------------- 1 file changed, 29 insertions(+), 62 deletions(-) diff --git a/Web/templates/upload_admin.html b/Web/templates/upload_admin.html index 5071946..0a2a8ee 100755 --- a/Web/templates/upload_admin.html +++ b/Web/templates/upload_admin.html @@ -1523,18 +1523,12 @@ document.getElementById('new-location-input').value = ''; } - // Globale Variablen definieren - let currentFetchedIsbn = null; - let currentBookData = null; - - // Function to fetch book information from ISBN (an window gebunden) - window.fetchBookInfo = function(formType) { - // Sicherheitsprüfung, falls die Variable in manchen Ladezuständen nicht existiert - if (typeof libraryModuleEnabled !== 'undefined' && !libraryModuleEnabled) { + // Function to fetch book information from ISBN + function fetchBookInfo(formType) { + if (!libraryModuleEnabled) { alert('Bibliotheks-Modul ist deaktiviert.'); return; } - const isbnField = document.getElementById('isbn'); const infoContainer = document.getElementById('book-info-container'); @@ -1543,25 +1537,13 @@ return; } - // Fallback, falls normalizeIsbnClient nicht geladen wurde - const isbn = typeof normalizeIsbnClient === 'function' ? normalizeIsbnClient(isbnField.value) : isbnField.value.trim(); + const isbn = normalizeIsbnClient(isbnField.value); if (!isbn) { infoContainer.innerHTML = '
Bitte geben Sie eine ISBN oder einen Barcode ein.
'; - currentFetchedIsbn = null; return; } - // FIX FÜR DAS DOPPELKLICK-PROBLEM: - // Wenn die gleiche ISBN bereits geladen wurde, brechen wir hier ab, - // um den Import-Button nicht durch das DOM-Refresh zu überschreiben. - if (currentFetchedIsbn === isbn && currentBookData !== null) { - return; - } - - // Setze aktuelle ISBN, um neue Anfragen während des Ladens zu blockieren - currentFetchedIsbn = isbn; - // Show loading indicator infoContainer.innerHTML = '
Informationen werden abgerufen...
'; @@ -1580,7 +1562,6 @@ .then(data => { if (data.error) { infoContainer.innerHTML = `
${data.error}
`; - currentFetchedIsbn = null; // Bei Fehler zurücksetzen return; } @@ -1588,37 +1569,35 @@ currentBookData = data; // Display book information with import button - // WICHTIG: onclick ruft jetzt explizit window.importBookInfo auf infoContainer.innerHTML = ` -
-

${data.title}

- ${data.authors ? `

Autor(en): ${data.authors}

` : ''} - ${data.publisher ? `

Verlag: ${data.publisher}

` : ''} - ${data.publishedDate ? `

Erscheinungsdatum: ${data.publishedDate}

` : ''} - ${data.pageCount ? `

Seitenanzahl: ${data.pageCount}

` : ''} - ${data.price ? `

Preis: ${data.price}

` : ''} - ${data.thumbnail ? `Buchcover` : ''} - ${data.description ? ` -
-
Beschreibung:
-

${data.description}

-
- ` : ''} - -
- `; +
+

${data.title}

+ ${data.authors ? `

Autor(en): ${data.authors}

` : ''} + ${data.publisher ? `

Verlag: ${data.publisher}

` : ''} + ${data.publishedDate ? `

Erscheinungsdatum: ${data.publishedDate}

` : ''} + ${data.pageCount ? `

Seitenanzahl: ${data.pageCount}

` : ''} + ${data.price ? `

Preis: ${data.price}

` : ''} + ${data.thumbnail ? `Buchcover` : ''} + ${data.description ? ` +
+
Beschreibung:
+

${data.description}

+
+ ` : ''} + +
+ `; }) .catch(error => { infoContainer.innerHTML = `
${error.message}
`; currentBookData = null; - currentFetchedIsbn = null; // Bei Fehler zurücksetzen }); - }; + } - // Function to import book information into form (an window gebunden) - window.importBookInfo = function(formType) { + // Function to import book information into form + function importBookInfo(formType) { if (!currentBookData) { alert('Keine Buchdaten verfügbar zum Import.'); return; @@ -1627,7 +1606,7 @@ // Get form fields const nameField = document.getElementById('name'); const descriptionField = document.getElementById('beschreibung'); - const priceField = document.getElementById('anschaffungskosten'); + const priceField = document.getElementById('anschaffungskosten'); // <-- NEU if (!nameField || !descriptionField) { alert('Fehler: Formularfelder nicht gefunden.'); @@ -1673,24 +1652,12 @@ } // Download and import book cover image if available - // Sicherstellen, dass die Funktion nicht crasht, falls sie auf der Seite fehlt if (currentBookData.thumbnail) { - if (typeof downloadBookCover === 'function') { - try { - downloadBookCover(currentBookData.thumbnail); - } catch(e) { - console.warn('Cover konnte nicht geladen werden:', e); - } - } + downloadBookCover(currentBookData.thumbnail); } // Show success message const infoContainer = document.getElementById('book-info-container'); - - // Alte Erfolgsmeldung entfernen, um Doppelungen zu vermeiden - const oldMessage = infoContainer.querySelector('.import-success-message'); - if (oldMessage) oldMessage.remove(); - const successMessage = document.createElement('div'); successMessage.className = 'import-success-message'; successMessage.textContent = 'Buchdaten erfolgreich in das Formular übernommen!'; @@ -1702,7 +1669,7 @@ successMessage.parentNode.removeChild(successMessage); } }, 3000); - }; + } function downloadBookCover(imageUrl) { if (!imageUrl) {