Last modified by XWikiGuest on 2026/03/11 21:04

From version 5.1
edited by XWikiGuest
on 2026/03/11 20:26
Change comment: There is no comment for this version
To version 3.1
edited by XWikiGuest
on 2026/03/11 20:17
Change comment: There is no comment for this version

Summary

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