feat: replace native confirm() with custom styled dialog
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c83d4d598
commit
f210d7350e
4 files changed
+32
-3
No files matched your search
@@ -572,10 +572,23 @@ export async function editPlRemoveCover() {
|
||||
} catch(e) { S._ndToken = null; toast('Fehler: '+e.message); }
|
||||
}
|
||||
|
||||
let _confirmResolve = null;
|
||||
export function _confirmOk() { document.getElementById('confirm-overlay').classList.remove('open'); _confirmResolve?.(true); _confirmResolve = null; }
|
||||
export function _confirmCancel() { document.getElementById('confirm-overlay').classList.remove('open'); _confirmResolve?.(false); _confirmResolve = null; }
|
||||
|
||||
function showConfirm(title, msg, okLabel = 'Bestätigen') {
|
||||
document.getElementById('confirm-title').textContent = title;
|
||||
document.getElementById('confirm-msg').textContent = msg;
|
||||
document.getElementById('confirm-ok-btn').textContent = okLabel;
|
||||
document.getElementById('confirm-overlay').classList.add('open');
|
||||
return new Promise(resolve => { _confirmResolve = resolve; });
|
||||
}
|
||||
|
||||
export async function deletePlaylist() {
|
||||
const pl = S._currentPlaylist;
|
||||
if (!pl) return;
|
||||
if (!confirm(`Playlist "${pl.name}" wirklich löschen?`)) return;
|
||||
const ok = await showConfirm('Playlist löschen', `"${pl.name}" wird unwiderruflich gelöscht.`, 'Löschen');
|
||||
if (!ok) return;
|
||||
try {
|
||||
await api('deletePlaylist', `&id=${pl.id}`);
|
||||
closeEditPlModal();
|
||||
|
||||
Reference in new issue
Block a user