diff --git a/Web/templates/upload_admin.html b/Web/templates/upload_admin.html
index f69ed54..23e0018 100755
--- a/Web/templates/upload_admin.html
+++ b/Web/templates/upload_admin.html
@@ -1067,6 +1067,24 @@
return false;
}
+ function handleIsbnLookupFromScanner() {
+ const isbnField = document.getElementById('isbn');
+ if (!isbnField) return false;
+
+ const normalizedIsbn = typeof normalizeIsbnClient === 'function' ? normalizeIsbnClient(isbnField.value) : isbnField.value.trim();
+ if (!normalizedIsbn) return false;
+
+ if (typeof updateIsbnLiveValidation === 'function') {
+ updateIsbnLiveValidation();
+ }
+
+ if (typeof fetchBookInfo === 'function') {
+ fetchBookInfo('upload');
+ }
+
+ return true;
+ }
+
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('form').forEach(function (form) {
form.addEventListener('keydown', function (event) {
@@ -1079,6 +1097,12 @@
if (['button', 'submit', 'reset', 'file', 'checkbox', 'radio', 'hidden'].includes(type)) return;
event.preventDefault();
+
+ if (target.id === 'isbn' || target.name === 'isbn') {
+ handleIsbnLookupFromScanner();
+ return;
+ }
+
focusNextFormField(target);
});
});
@@ -1445,10 +1469,32 @@
scanModeSelect.addEventListener('change', toggleScanMode);
}
- // 4. ISBN Live-Validierung
+ // 4. ISBN Live-Validierung und automatische Abfrage nach Scan/Enter
const isbnInput = document.getElementById('isbn');
- if (isbnInput && typeof updateIsbnLiveValidation === 'function') {
- isbnInput.addEventListener('input', updateIsbnLiveValidation);
+ if (isbnInput) {
+ if (typeof updateIsbnLiveValidation === 'function') {
+ isbnInput.addEventListener('input', updateIsbnLiveValidation);
+ }
+
+ let isbnLookupTimer = null;
+ isbnInput.addEventListener('input', function () {
+ clearTimeout(isbnLookupTimer);
+ const normalizedIsbn = typeof normalizeIsbnClient === 'function' ? normalizeIsbnClient(isbnInput.value) : isbnInput.value.trim();
+ if (normalizedIsbn) {
+ isbnLookupTimer = setTimeout(function () {
+ handleIsbnLookupFromScanner();
+ }, 250);
+ }
+ });
+
+ isbnInput.addEventListener('change', function () {
+ if (typeof normalizeIsbnClient === 'function') {
+ const normalizedIsbn = normalizeIsbnClient(isbnInput.value);
+ if (normalizedIsbn) {
+ handleIsbnLookupFromScanner();
+ }
+ }
+ });
}
});
// Load predefined filter values for dropdowns