Linkding + SingleFile Test

Version 12.1 by XWikiGuest on 2026/03/11 20:55
Warning
For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Linkding + SingleFile Test

Bookmarks met archief-viewer. Klik op het archief-icoon om de opgeslagen versie te bekijken.

#ldsf-container {
  display: flex;
  height: 75vh;
  border: 1px solid #4e5d6c;
  border-radius: 4px;
  overflow: hidden;
  background: #1a2a3a;
}
#ldsf-left {
  width: 35%;
  min-width: 200px;
  max-width: 60%;
  overflow-y: auto;
  background: #2b3e50;
  display: flex;
  flex-direction: column;
}
#ldsf-divider {
  width: 6px;
  background: #4e5d6c;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s;
}
#ldsf-divider:hover, #ldsf-divider.dragging { background: #df691a; }
#ldsf-right {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: #fff;
}
#ldsf-status { color: #6b7c8d; font-size: 13px; padding: 8px 12px; flex-shrink: 0; }
#ldsf-bookmarks { overflow-y: auto; flex: 1; }
#ldsf-bookmarks ul { list-style: none; padding: 0; margin: 0; }
#ldsf-bookmarks li {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(78,93,108,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}
#ldsf-bookmarks li:hover { background: #3b4e60; }
#ldsf-bookmarks a {
  color: #5bc0de;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
#ldsf-bookmarks a:hover { color: #df691a; }
#ldsf-bookmarks .sf-btn {
  cursor: pointer;
  background: #4e5d6c;
  border: none;
  color: #5bc0de;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  flex-shrink: 0;
}
#ldsf-bookmarks .sf-btn:hover { background: #df691a; color: #fff; }
#ldsf-viewer-bar {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  background: #2b3e50;
  color: #6b7c8d;
  font-size: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid #4e5d6c;
}
#ldsf-viewer-bar .close-btn {
  cursor: pointer;
  background: none;
  border: none;
  color: #d9534f;
  font-size: 18px;
  padding: 0 4px;
}
#ldsf-viewer-bar .close-btn:hover { color: #ff6b6b; }
#ldsf-viewer-frame {
  width: 100%;
  flex: 1;
  border: none;
  background: #fff;
}
#ldsf-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #6b7c8d;
  font-size: 16px;
  background: #2b3e50;
}
Laden...
... ×
Klik op 📄 om archief te bekijken
var LDSF_LINKDING_URL = 'https://bookmarks.rhebergen.org/api/bookmarks/';
var LDSF_TOKEN = '3b7443e0f84e2b2b269adebb96d7475e4a5e653e';
var LDSF_TAG = 'Nuclear-&-Energy';
var LDSF_COUNT = 20;
var LDSF_SHARE = 'eT2X9ttBHK5GoEY';
var LDSF_WEBDAV = 'https://cloud.rhebergen.org/public.php/webdav/';
var LDSF_AUTH = 'Basic ' + btoa(LDSF_SHARE + ':');
var ldsf_urlToFile = {};
var ldsf_archiveMap = {};

function ldsfFindArchive(url) {
  var v = [url, url.replace(/\/$/, ''), url + '/', url.replace(/\?.*$/, '')];
  for (var i = 0; i < v.length; i++) { if (ldsf_urlToFile[v[i]]) return ldsf_urlToFile[v[i]]; }
  return null;
}

function ldsfOpen(idx) {
  var f = ldsf_archiveMap[idx];
  if (f) ldsfShowArchive(f);
}

function ldsfShowArchive(filename) {
  document.getElementById('ldsf-viewer-title').textContent = filename.replace(/\.html?$/i, '');
  document.getElementById('ldsf-viewer-bar').style.display = 'flex';
  document.getElementById('ldsf-placeholder').style.display = 'none';
  var frame = document.getElementById('ldsf-viewer-frame');
  frame.style.display = 'block';
  frame.srcdoc = '

Laden...

'; fetch(LDSF_WEBDAV + encodeURIComponent(filename), { headers: { 'Authorization': LDSF_AUTH } }) .then(function(r) { return r.text(); }) .then(function(html) { frame.srcdoc = html; }) .catch(function(err) { frame.srcdoc = '

Fout: ' + err.message + '

'; }); } function ldsfCloseViewer() { document.getElementById('ldsf-viewer-bar').style.display = 'none'; document.getElementById('ldsf-viewer-frame').style.display = 'none'; document.getElementById('ldsf-placeholder').style.display = 'flex'; } function ldsfLoadBookmarks() { var apiUrl = LDSF_LINKDING_URL + '?limit=' + LDSF_COUNT + '&q=%23' + encodeURIComponent(LDSF_TAG); fetch(apiUrl, { headers: { 'Authorization': 'Token ' + LDSF_TOKEN } }) .then(function(r) { return r.json(); }) .then(function(data) { var total = data.count || 0; var archiveCount = 0; var container = document.getElementById('ldsf-bookmarks'); var html = '
  • '; (data.results || []).forEach(function(bm, idx) { var title = bm.title || bm.website_title || bm.url; var fname = ldsfFindArchive(bm.url); if (fname) { archiveCount++; ldsf_archiveMap[String(idx)] = fname; } html += '
  • '; if (fname) html += '📄'; html += '' + title + ''; }); html += '
'; container.innerHTML = html; document.getElementById('ldsf-status').textContent = total + ' bookmarks, ' + archiveCount + ' met archief'; }) .catch(function(err) { document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; }); } // Global click handler for archive buttons and close button document.addEventListener('click', function(e) { var el = e.target; if (el && el.getAttribute) { if (el.getAttribute('data-sfidx') !== null) { var idx = el.getAttribute('data-sfidx'); if (ldsf_archiveMap[idx]) ldsfShowArchive(ldsf_archiveMap[idx]); } if (el.getAttribute('data-sfclose') !== null) { ldsfCloseViewer(); } } }, true); // Draggable divider var ldsf_divider = document.getElementById('ldsf-divider'); var ldsf_left = document.getElementById('ldsf-left'); var ldsf_dragging = false; ldsf_divider.addEventListener('mousedown', function(e) { ldsf_dragging = true; ldsf_divider.classList.add('dragging'); e.preventDefault(); }); document.addEventListener('mousemove', function(e) { if (!ldsf_dragging) return; var container = document.getElementById('ldsf-container'); var rect = container.getBoundingClientRect(); var w = e.clientX - rect.left; if (w >= 200 && w <= rect.width * 0.6) ldsf_left.style.width = w + 'px'; }); document.addEventListener('mouseup', function() { if (ldsf_dragging) { ldsf_dragging = false; ldsf_divider.classList.remove('dragging'); } }); // Load index then bookmarks fetch(LDSF_WEBDAV + 'index.json', { headers: { 'Authorization': LDSF_AUTH } }) .then(function(r) { return r.ok ? r.json() : {}; }) .then(function(idx) { Object.keys(idx).forEach(function(f) { ldsf_urlToFile[idx[f]] = f; }); ldsfLoadBookmarks(); }) .catch(function() { ldsfLoadBookmarks(); });