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

From version 6.1
edited by XWikiGuest
on 2026/03/11 20:30
Change comment: There is no comment for this version
To version 11.1
edited by XWikiGuest
on 2026/03/11 20:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -78,6 +78,7 @@
78 78  </style>
79 79  
80 80  <div id="ldsf-wrapper">
81 + <button id="ldsf-test-btn" style="background:#df691a;color:#fff;padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-bottom:10px;">TEST KLIK</button>
81 81   <div id="ldsf-status">Laden...</div>
82 82   <div id="ldsf-bookmarks"></div>
83 83   <div id="ldsf-viewer-container">
... ... @@ -135,14 +135,17 @@
135 135   var archiveCount = 0;
136 136   var container = document.getElementById('ldsf-bookmarks');
137 137   var html = '<ul>';
139 +
138 138   (data.results || []).forEach(function(bm, idx) {
139 139   var title = bm.title || bm.website_title || bm.url;
140 140   var fname = ldsfFindArchive(bm.url);
141 - if (fname) { archiveCount++; ldsf_archiveMap[idx] = fname; }
143 + if (idx < 3) console.log('BM[' + idx + ']:', bm.url, '-> match:', fname);
144 + if (fname) { archiveCount++; ldsf_archiveMap[String(idx)] = fname; }
142 142   html += '<li>';
143 - if (fname) html += '<button class="sf-btn" onclick="ldsfOpen(' + idx + ')" title="Archief bekijken">&#128196;</button>';
146 + if (fname) html += '<span class="sf-btn" data-sfidx="' + idx + '" title="Archief bekijken">&#128196;</span>';
144 144   html += '<a href="' + bm.url + '" target="_blank">' + title + '</a></li>';
145 145   });
149 +
146 146   html += '</ul>';
147 147   container.innerHTML = html;
148 148   document.getElementById('ldsf-status').textContent = total + ' bookmarks, ' + archiveCount + ' met archief';
... ... @@ -150,14 +150,30 @@
150 150   .catch(function(err) { document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; });
151 151  }
152 152  
157 +// Global click handler for archive buttons
158 +document.addEventListener('click', function(e) {
159 + var el = e.target;
160 + if (el && el.getAttribute && el.getAttribute('data-sfidx') !== null) {
161 + var idx = el.getAttribute('data-sfidx');
162 + console.log('Archive button clicked, idx:', idx, 'file:', ldsf_archiveMap[idx]);
163 + if (ldsf_archiveMap[idx]) ldsfShowArchive(ldsf_archiveMap[idx]);
164 + }
165 +}, true);
166 +
167 +// Debug test button
168 +document.getElementById('ldsf-test-btn').addEventListener('click', function() {
169 + alert('archiveMap: ' + JSON.stringify(ldsf_archiveMap) + '\nurlToFile: ' + JSON.stringify(ldsf_urlToFile));
170 +});
171 +
153 153  // Load index then bookmarks
154 154  fetch(LDSF_WEBDAV + 'index.json', { headers: { 'Authorization': LDSF_AUTH } })
155 155  .then(function(r) { return r.ok ? r.json() : {}; })
156 156  .then(function(idx) {
176 + console.log('SingleFile index loaded:', idx);
157 157   Object.keys(idx).forEach(function(f) { ldsf_urlToFile[idx[f]] = f; });
158 158   ldsfLoadBookmarks();
159 159  })
160 -.catch(function() { ldsfLoadBookmarks(); });
180 +.catch(function(err) { console.log('SingleFile index FAILED:', err); ldsfLoadBookmarks(); });
161 161  </script>
162 162  {{/html}}
163 163