Fix trash: restore/perm delete buttons not working when clicking card content
This commit is contained in:
+6
-4
@@ -83,10 +83,12 @@ document.getElementById('emptyBtn').addEventListener('click', emptyTrash);
|
|||||||
document.getElementById('imgModal').addEventListener('click', e => e.currentTarget.classList.remove('open'));
|
document.getElementById('imgModal').addEventListener('click', e => e.currentTarget.classList.remove('open'));
|
||||||
|
|
||||||
document.getElementById('grid').addEventListener('click', e => {
|
document.getElementById('grid').addEventListener('click', e => {
|
||||||
const rs = e.target.closest('[data-restore]');
|
const card = e.target.closest('.card');
|
||||||
if (rs) { restoreEntry(parseInt(rs.dataset.restore, 10)); return; }
|
if (!card) return;
|
||||||
const hd = e.target.closest('[data-hard]');
|
const rs = card.querySelector('[data-restore]');
|
||||||
if (hd) { hardDelete(parseInt(hd.dataset.hard, 10)); }
|
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 () => {
|
(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user