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 4.1
edited by XWikiGuest
on 2026/03/11 20:22
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,21 @@
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 + }
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) {
179 + 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  
184 + // Toggle active button
185 + document.querySelectorAll('#ldsf-bookmarks .sf-btn').forEach(function(b) { b.classList.remove('active'); });
186 + btn.classList.add('active');
187 +
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>';