Fix trash: restore/perm delete buttons not working when clicking card content

This commit is contained in:
dev
2026-09-09 23:32:06 +03:00
parent 0f267ca6a9
commit 6197f57c43
+6 -4
View File
@@ -83,10 +83,12 @@ document.getElementById('emptyBtn').addEventListener('click', emptyTrash);
document.getElementById('imgModal').addEventListener('click', e => e.currentTarget.classList.remove('open'));
document.getElementById('grid').addEventListener('click', e => {
const rs = e.target.closest('[data-restore]');
if (rs) { restoreEntry(parseInt(rs.dataset.restore, 10)); return; }
const hd = e.target.closest('[data-hard]');
if (hd) { hardDelete(parseInt(hd.dataset.hard, 10)); }
const card = e.target.closest('.card');
if (!card) return;
const rs = card.querySelector('[data-restore]');
if (rs && (e.target === rs || rs.contains(e.target))) { restoreEntry(parseInt(rs.dataset.restore, 10)); return; }
const hd = card.querySelector('[data-hard]');
if (hd && (e.target === hd || hd.contains(e.target))) { hardDelete(parseInt(hd.dataset.hard, 10)); }
});
(async () => {