Changes for page Linkding + SingleFile Archief
Last modified by XWikiGuest on 2026/03/11 21:04
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -96,9 +96,10 @@ 96 96 var LINKDING_TAG = 'Nuclear-&-Energy'; 97 97 var LINKDING_COUNT = 20; 98 98 99 - var WEBDAV_BASE = 'https://cloud.rhebergen.org/remote.php/dav/files/jan_rhebergen/SingleFile-Archives/'; 99 + var SHARE_TOKEN = 'eT2X9ttBHK5GoEY'; 100 + var WEBDAV_BASE = 'https://cloud.rhebergen.org/public.php/webdav/'; 100 100 var INDEX_URL = WEBDAV_BASE + 'index.json'; 101 - var NC_AUTH = 'Basic amFuX3JoZWJlcmdlbjpAWnMzUUwkJmZ4TVE=';102 + var NC_AUTH = 'Basic ' + btoa(SHARE_TOKEN + ':'); 102 102 103 103 var urlToFile = {}; // reverse map: URL -> filename 104 104 var archiveMap = {}; // button index -> filename ... ... @@ -143,8 +143,8 @@ 143 143 144 144 html += '<li>'; 145 145 if (fname) { 146 - html += '<button class="sf-btn" data-idx="' + idx + '" title="Archief bekijken">📄</button>'; 147 147 archiveMap[idx] = fname; 148 + html += '<button class="sf-btn" onclick="ldsfOpen(' + idx + ')" title="Archief bekijken">📄</button>'; 148 148 } 149 149 html += '<a href="' + bm.url + '" target="_blank">' + title + '</a>'; 150 150 html += '</li>'; ... ... @@ -153,16 +153,6 @@ 153 153 html += '</ul>'; 154 154 container.innerHTML = html; 155 155 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 - }); 166 166 }) 167 167 .catch(function(err) { 168 168 document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; ... ... @@ -169,16 +169,19 @@ 169 169 }); 170 170 } 171 171 163 + // Open archive by index 164 + window.ldsfOpen = function(idx) { 165 + var filename = archiveMap[idx]; 166 + if (!filename) return; 167 + ldsfShowArchive(filename); 168 + }; 169 + 172 172 // Show archive in viewer panel 173 - window.ldsfShowArchive = function(filename , btn) {171 + window.ldsfShowArchive = function(filename) { 174 174 var container = document.getElementById('ldsf-viewer-container'); 175 175 var frame = document.getElementById('ldsf-viewer-frame'); 176 176 var titleEl = document.getElementById('ldsf-viewer-title'); 177 177 178 - // Toggle active button 179 - document.querySelectorAll('#ldsf-bookmarks .sf-btn').forEach(function(b) { b.classList.remove('active'); }); 180 - btn.classList.add('active'); 181 - 182 182 titleEl.textContent = filename.replace(/\.html?$/i, ''); 183 183 container.style.display = 'block'; 184 184 frame.srcdoc = '<p style="padding:20px;color:#666">Laden...</p>';