diff --git a/static/js/main.js b/static/js/main.js index e4a2947..cc138db 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -221,7 +221,11 @@ document.addEventListener('DOMContentLoaded', () => { utils.fetchJson(`${API_ENDPOINTS.download}?id=${encodeURIComponent(bookId)}`) ); - // Uncheck all selected checkboxes + this.clearAllCheckboxes(); + modal.close(); + }, + + clearAllCheckboxes() { selectedBooks.forEach((bookId) => { const checkbox = document.getElementById(`book-${bookId}`); if (checkbox) checkbox.checked = false; @@ -232,13 +236,13 @@ document.addEventListener('DOMContentLoaded', () => { selectedBooks.clear(); utils.updateDownloadSelectedButton(); - modal.close(); } }; // Search Functions const search = { async performSearch(query) { + utils.clearAllCheckboxes(); if (STATE.isSearching) return; try {