Allow compainion opening in thumbnail view
This commit is contained in:
+6
-4
@@ -115,13 +115,15 @@
|
|||||||
function wireFileLinks() {
|
function wireFileLinks() {
|
||||||
if (!state.available) return;
|
if (!state.available) return;
|
||||||
document.addEventListener('click', function (e) {
|
document.addEventListener('click', function (e) {
|
||||||
var item = e.target.closest && e.target.closest('.list-item');
|
if (!e.target.closest) return;
|
||||||
if (!item) return;
|
// Match both listing styles: table rows expose the file link inside
|
||||||
var anchor = e.target.closest('a');
|
// 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;
|
if (!anchor) return;
|
||||||
|
var item = anchor.closest('.list-item');
|
||||||
// Only intercept the primary file link, and only for files (not folders).
|
// Only intercept the primary file link, and only for files (not folders).
|
||||||
// Folders end with "/" — let the browser navigate normally.
|
// 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;
|
if (!path || path.endsWith('/')) return;
|
||||||
// Allow modified clicks (open in new tab, etc.) to pass through.
|
// Allow modified clicks (open in new tab, etc.) to pass through.
|
||||||
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user