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

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

Summary

Details

Page properties
Content
... ... @@ -78,7 +78,6 @@
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>
82 82   <div id="ldsf-status">Laden...</div>
83 83   <div id="ldsf-bookmarks"></div>
84 84   <div id="ldsf-viewer-container">
... ... @@ -135,55 +135,30 @@
135 135   var total = data.count || 0;
136 136   var archiveCount = 0;
137 137   var container = document.getElementById('ldsf-bookmarks');
138 - var ul = document.createElement('ul');
139 -
140 - (data.results || []).forEach(function(bm) {
137 + var html = '<ul>';
138 + (data.results || []).forEach(function(bm, idx) {
141 141   var title = bm.title || bm.website_title || bm.url;
142 142   var fname = ldsfFindArchive(bm.url);
143 - if (fname) archiveCount++;
144 -
145 - var li = document.createElement('li');
146 -
147 - if (fname) {
148 - var btn = document.createElement('button');
149 - btn.className = 'sf-btn';
150 - btn.title = 'Archief bekijken';
151 - btn.textContent = '\uD83D\uDCC4';
152 - btn.addEventListener('click', (function(f) {
153 - return function() { ldsfShowArchive(f); };
154 - })(fname));
155 - li.appendChild(btn);
156 - }
157 -
158 - var a = document.createElement('a');
159 - a.href = bm.url;
160 - a.target = '_blank';
161 - a.textContent = title;
162 - li.appendChild(a);
163 - ul.appendChild(li);
141 + if (fname) { archiveCount++; ldsf_archiveMap[idx] = fname; }
142 + html += '<li>';
143 + if (fname) html += '<button class="sf-btn" onclick="ldsfOpen(' + idx + ')" title="Archief bekijken">&#128196;</button>';
144 + html += '<a href="' + bm.url + '" target="_blank">' + title + '</a></li>';
164 164   });
165 -
166 - container.innerHTML = '';
167 - container.appendChild(ul);
146 + html += '</ul>';
147 + container.innerHTML = html;
168 168   document.getElementById('ldsf-status').textContent = total + ' bookmarks, ' + archiveCount + ' met archief';
169 169   })
170 170   .catch(function(err) { document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; });
171 171  }
172 172  
173 -// Debug test button
174 -document.getElementById('ldsf-test-btn').addEventListener('click', function() {
175 - alert('archiveMap: ' + JSON.stringify(ldsf_archiveMap) + '\nurlToFile: ' + JSON.stringify(ldsf_urlToFile));
176 -});
177 -
178 178  // Load index then bookmarks
179 179  fetch(LDSF_WEBDAV + 'index.json', { headers: { 'Authorization': LDSF_AUTH } })
180 180  .then(function(r) { return r.ok ? r.json() : {}; })
181 181  .then(function(idx) {
182 - console.log('SingleFile index loaded:', idx);
183 183   Object.keys(idx).forEach(function(f) { ldsf_urlToFile[idx[f]] = f; });
184 184   ldsfLoadBookmarks();
185 185  })
186 -.catch(function(err) { console.log('SingleFile index FAILED:', err); ldsfLoadBookmarks(); });
160 +.catch(function() { ldsfLoadBookmarks(); });
187 187  </script>
188 188  {{/html}}
189 189