« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/image.js2
-rw-r--r--src/static/client.js8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 745dfe9e..45379629 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -75,6 +75,7 @@ export default {
           : originalSrc);
 
     const willLink = typeof slots.link === 'string' || slots.link;
+    const customLink = typeof slots.link === 'string';
 
     const willReveal =
       slots.reveal &&
@@ -125,6 +126,7 @@ export default {
       width: slots.width,
       height: slots.height,
       'data-original-size': fileSize,
+      'data-no-image-preview': customLink,
     };
 
     const nonlazyHTML =
diff --git a/src/static/client.js b/src/static/client.js
index 2f0b6aee..dab92ffc 100644
--- a/src/static/client.js
+++ b/src/static/client.js
@@ -653,8 +653,12 @@ function addImageOverlayClickHandlers() {
     return;
   }
 
-  for (const img of document.querySelectorAll('.image-link')) {
-    img.addEventListener('click', handleImageLinkClicked);
+  for (const link of document.querySelectorAll('.image-link')) {
+    if (link.querySelector('img').hasAttribute('data-no-image-preview')) {
+      continue;
+    }
+
+    link.addEventListener('click', handleImageLinkClicked);
   }
 
   const actionContainer = document.getElementById('image-overlay-action-container');