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
-
... ... @@ -144,8 +144,8 @@ 144 144 145 145 html += '<li>'; 146 146 if (fname) { 147 - html += '<button class="sf-btn" data-idx="' + idx + '" title="Archief bekijken">📄</button>'; 148 148 archiveMap[idx] = fname; 148 + html += '<button class="sf-btn" onclick="ldsfOpen(' + idx + ')" title="Archief bekijken">📄</button>'; 149 149 } 150 150 html += '<a href="' + bm.url + '" target="_blank">' + title + '</a>'; 151 151 html += '</li>'; ... ... @@ -154,16 +154,6 @@ 154 154 html += '</ul>'; 155 155 container.innerHTML = html; 156 156 document.getElementById('ldsf-status').textContent = total + ' bookmarks, ' + archiveCount + ' met archief'; 157 - 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 - }); 167 167 }) 168 168 .catch(function(err) { 169 169 document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; ... ... @@ -170,16 +170,19 @@ 170 170 }); 171 171 } 172 172 163 + // Open archive by index 164 + window.ldsfOpen = function(idx) { 165 + var filename = archiveMap[idx]; 166 + if (!filename) return; 167 + ldsfShowArchive(filename); 168 + }; 169 + 173 173 // Show archive in viewer panel 174 - window.ldsfShowArchive = function(filename , btn) {171 + window.ldsfShowArchive = function(filename) { 175 175 var container = document.getElementById('ldsf-viewer-container'); 176 176 var frame = document.getElementById('ldsf-viewer-frame'); 177 177 var titleEl = document.getElementById('ldsf-viewer-title'); 178 178 179 - // Toggle active button 180 - document.querySelectorAll('#ldsf-bookmarks .sf-btn').forEach(function(b) { b.classList.remove('active'); }); 181 - btn.classList.add('active'); 182 - 183 183 titleEl.textContent = filename.replace(/\.html?$/i, ''); 184 184 container.style.display = 'block'; 185 185 frame.srcdoc = '<p style="padding:20px;color:#666">Laden...</p>';