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,21 +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 - // 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 - } 172 172 }) 173 173 .catch(function(err) { 174 174 document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; ... ... @@ -175,16 +175,19 @@ 175 175 }); 176 176 } 177 177 163 + // Open archive by index 164 + window.ldsfOpen = function(idx) { 165 + var filename = archiveMap[idx]; 166 + if (!filename) return; 167 + ldsfShowArchive(filename); 168 + }; 169 + 178 178 // Show archive in viewer panel 179 - window.ldsfShowArchive = function(filename , btn) {171 + window.ldsfShowArchive = function(filename) { 180 180 var container = document.getElementById('ldsf-viewer-container'); 181 181 var frame = document.getElementById('ldsf-viewer-frame'); 182 182 var titleEl = document.getElementById('ldsf-viewer-title'); 183 183 184 - // Toggle active button 185 - document.querySelectorAll('#ldsf-bookmarks .sf-btn').forEach(function(b) { b.classList.remove('active'); }); 186 - btn.classList.add('active'); 187 - 188 188 titleEl.textContent = filename.replace(/\.html?$/i, ''); 189 189 container.style.display = 'block'; 190 190 frame.srcdoc = '<p style="padding:20px;color:#666">Laden...</p>';