Fix audiobook export modal bindings and position for SPA routing
This commit is contained in:
parent
ee17ed97d1
commit
882e1ede55
2
static/dist/main.min.js
vendored
2
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@ -6158,20 +6158,24 @@ 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);
|
||||||
|
// Bind event listeners once when the modal is first moved
|
||||||
|
document.getElementById('ab-export-modal-close')?.addEventListener('click', () => modal.hidden = true);
|
||||||
|
document.getElementById('ab-export-modal-cancel')?.addEventListener('click', () => modal.hidden = true);
|
||||||
|
document.getElementById('ab-export-modal-start')?.addEventListener('click', () => {
|
||||||
|
modal.hidden = true;
|
||||||
|
const formatEl = document.querySelector('input[name="ab_export_format"]:checked');
|
||||||
|
const format = formatEl ? formatEl.value : 'chapter';
|
||||||
|
const folderEl = document.getElementById('ab-export-server-folder');
|
||||||
|
const folder = folderEl ? folderEl.value : '';
|
||||||
|
const checkboxes = Array.from(document.querySelectorAll('.ab-export-chapter-cb'));
|
||||||
|
const selectedChapterIndices = checkboxes.filter(cb => cb.checked).map(cb => parseInt(cb.value, 10));
|
||||||
|
audiobookExport({ format, selectedChapterIndices, folder });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
modal.hidden = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
document.getElementById('ab-export-modal-close')?.addEventListener('click', () => document.getElementById('audiobook-export-modal').hidden = true);
|
|
||||||
document.getElementById('ab-export-modal-cancel')?.addEventListener('click', () => document.getElementById('audiobook-export-modal').hidden = true);
|
|
||||||
document.getElementById('ab-export-modal-start')?.addEventListener('click', () => {
|
|
||||||
document.getElementById('audiobook-export-modal').hidden = true;
|
|
||||||
const formatEl = document.querySelector('input[name="ab_export_format"]:checked');
|
|
||||||
const format = formatEl ? formatEl.value : 'chapter';
|
|
||||||
const folderEl = document.getElementById('ab-export-server-folder');
|
|
||||||
const folder = folderEl ? folderEl.value : '';
|
|
||||||
const checkboxes = Array.from(document.querySelectorAll('.ab-export-chapter-cb'));
|
|
||||||
const selectedChapterIndices = checkboxes.filter(cb => cb.checked).map(cb => parseInt(cb.value, 10));
|
|
||||||
audiobookExport({ format, selectedChapterIndices, folder });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user