Fix audiobook export modal bindings and position for SPA routing

This commit is contained in:
mARTin-B78 2026-08-23 11:58:36 +02:00
parent ee17ed97d1
commit 882e1ede55
2 changed files with 21 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -6158,14 +6158,14 @@ function audiobookExportDialog() {
if (typeof _abInitPauseUI === 'function') _abInitPauseUI(); if (typeof _abInitPauseUI === 'function') _abInitPauseUI();
const modal = document.getElementById('audiobook-export-modal'); const modal = document.getElementById('audiobook-export-modal');
if (modal) modal.hidden = false; if (modal) {
}; if (modal.parentElement !== document.body) {
document.body.appendChild(modal);
document.addEventListener('DOMContentLoaded', () => { // Bind event listeners once when the modal is first moved
document.getElementById('ab-export-modal-close')?.addEventListener('click', () => document.getElementById('audiobook-export-modal').hidden = true); document.getElementById('ab-export-modal-close')?.addEventListener('click', () => modal.hidden = true);
document.getElementById('ab-export-modal-cancel')?.addEventListener('click', () => document.getElementById('audiobook-export-modal').hidden = true); document.getElementById('ab-export-modal-cancel')?.addEventListener('click', () => modal.hidden = true);
document.getElementById('ab-export-modal-start')?.addEventListener('click', () => { document.getElementById('ab-export-modal-start')?.addEventListener('click', () => {
document.getElementById('audiobook-export-modal').hidden = true; modal.hidden = true;
const formatEl = document.querySelector('input[name="ab_export_format"]:checked'); const formatEl = document.querySelector('input[name="ab_export_format"]:checked');
const format = formatEl ? formatEl.value : 'chapter'; const format = formatEl ? formatEl.value : 'chapter';
const folderEl = document.getElementById('ab-export-server-folder'); const folderEl = document.getElementById('ab-export-server-folder');
@ -6174,4 +6174,8 @@ document.addEventListener('DOMContentLoaded', () => {
const selectedChapterIndices = checkboxes.filter(cb => cb.checked).map(cb => parseInt(cb.value, 10)); const selectedChapterIndices = checkboxes.filter(cb => cb.checked).map(cb => parseInt(cb.value, 10));
audiobookExport({ format, selectedChapterIndices, folder }); audiobookExport({ format, selectedChapterIndices, folder });
}); });
}); }
modal.hidden = false;
}
}