Changes for page Linkding + SingleFile Archief
Last modified by XWikiGuest on 2026/03/11 21:04
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -155,20 +155,15 @@ 155 155 container.innerHTML = html; 156 156 document.getElementById('ldsf-status').textContent = total + ' bookmarks, ' + archiveCount + ' met archief'; 157 157 158 - // Bind click handlers directly to buttons 159 - var buttons = container.querySelectorAll('.sf-btn'); 160 - for (var b = 0; b < buttons.length; b++) { 161 - (function(btn) { 162 - var idx = btn.getAttribute('data-idx'); 163 - btn.addEventListener('click', function(ev) { 164 - ev.preventDefault(); 165 - ev.stopPropagation(); 166 - if (archiveMap[idx]) { 167 - ldsfShowArchive(archiveMap[idx], btn); 168 - } 169 - }); 170 - })(buttons[b]); 171 - } 158 + // Event delegation for archive buttons 159 + container.addEventListener('click', function(e) { 160 + var btn = e.target.closest('.sf-btn'); 161 + if (!btn) return; 162 + var idx = btn.getAttribute('data-idx'); 163 + if (idx !== null && archiveMap[idx]) { 164 + ldsfShowArchive(archiveMap[idx], btn); 165 + } 166 + }); 172 172 }) 173 173 .catch(function(err) { 174 174 document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message;