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 2.1
edited by XWikiGuest
on 2026/03/11 20:04
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -96,10 +96,9 @@
96 96   var LINKDING_TAG = 'Nuclear-&-Energy';
97 97   var LINKDING_COUNT = 20;
98 98  
99 - var SHARE_TOKEN = 'eT2X9ttBHK5GoEY';
100 - var WEBDAV_BASE = 'https://cloud.rhebergen.org/public.php/webdav/';
99 + var WEBDAV_BASE = 'https://cloud.rhebergen.org/remote.php/dav/files/jan_rhebergen/SingleFile-Archives/';
101 101   var INDEX_URL = WEBDAV_BASE + 'index.json';
102 - var NC_AUTH = 'Basic ' + btoa(SHARE_TOKEN + ':');
101 + var NC_AUTH = 'Basic amFuX3JoZWJlcmdlbjpAWnMzUUwkJmZ4TVE=';
103 103  
104 104   var urlToFile = {}; // reverse map: URL -> filename
105 105   var archiveMap = {}; // button index -> filename
... ... @@ -144,8 +144,8 @@
144 144  
145 145   html += '<li>';
146 146   if (fname) {
146 + 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';
156 +
157 + // Event delegation for archive buttons
158 + container.addEventListener('click', function(e) {
159 + var btn = e.target.closest('.sf-btn');
160 + if (!btn) return;
161 + var idx = btn.getAttribute('data-idx');
162 + if (idx !== null && archiveMap[idx]) {
163 + ldsfShowArchive(archiveMap[idx], btn);
164 + }
165 + });
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) {
173 + 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  
178 + // Toggle active button
179 + document.querySelectorAll('#ldsf-bookmarks .sf-btn').forEach(function(b) { b.classList.remove('active'); });
180 + btn.classList.add('active');
181 +
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>';