Allow compainion opening in thumbnail view

This commit is contained in:
2026-06-04 09:22:53 +02:00
parent 0478bc6305
commit 4e24f876c9
+6 -4
View File
@@ -115,13 +115,15 @@
function wireFileLinks() {
if (!state.available) return;
document.addEventListener('click', function (e) {
var item = e.target.closest && e.target.closest('.list-item');
if (!item) return;
var anchor = e.target.closest('a');
if (!e.target.closest) return;
// Match both listing styles: table rows expose the file link inside
// a .list-item row; thumbnail tiles are bare a.thumb-tile anchors.
var anchor = e.target.closest('.list-item a, a.thumb-tile');
if (!anchor) return;
var item = anchor.closest('.list-item');
// Only intercept the primary file link, and only for files (not folders).
// Folders end with "/" — let the browser navigate normally.
var path = item.dataset.path || anchor.getAttribute('href');
var path = (item && item.dataset.path) || anchor.getAttribute('href');
if (!path || path.endsWith('/')) return;
// Allow modified clicks (open in new tab, etc.) to pass through.
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;