« get me outta code hell

content: generatePageLayout: image overlay container - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/client.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-07 11:32:45 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-07 11:32:45 -0300
commit0e150bbdf4c384bd2eee6fe3e06ab7b4eb3563da (patch)
treef3ac6a91e4b0ddb75c81d09d2799b623789645f2 /src/static/client.js
parent05b7dc2f86b7b4e89b07cc54f53e851fe11e0e1a (diff)
content: generatePageLayout: image overlay container
Diffstat (limited to 'src/static/client.js')
-rw-r--r--src/static/client.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/static/client.js b/src/static/client.js
index 35ef82e..6212295 100644
--- a/src/static/client.js
+++ b/src/static/client.js
@@ -645,11 +645,17 @@ updateStickyHeading();
 // Image overlay ------------------------------------------
 
 function addImageOverlayClickHandlers() {
+  const container = document.getElementById('image-overlay-container');
+
+  if (!container) {
+    console.warn(`#image-overlay-container missing, image overlay module disabled.`);
+    return;
+  }
+
   for (const img of document.querySelectorAll('.image-link')) {
     img.addEventListener('click', handleImageLinkClicked);
   }
 
-  const container = document.getElementById('image-overlay-container');
   const actionContainer = document.getElementById('image-overlay-action-container');
 
   container.addEventListener('click', handleContainerClicked);