// lightbox.js — click any image inside rendered Markdown to view it full-screen. (function () { "use strict"; function open(src, alt) { var overlay = document.createElement("div"); overlay.className = "lightbox"; var img = document.createElement("img"); img.src = src; img.alt = alt || ""; overlay.appendChild(img); document.body.appendChild(overlay); document.body.style.overflow = "hidden"; function close() { overlay.remove(); document.body.style.overflow = ""; document.removeEventListener("keydown", onKey); } function onKey(e) { if (e.key === "Escape") close(); } overlay.addEventListener("click", close); document.addEventListener("keydown", onKey); } document.addEventListener("DOMContentLoaded", function () { document.querySelectorAll(".markdown img").forEach(function (img) { img.classList.add("zoomable"); img.addEventListener("click", function () { open(img.src, img.alt); }); }); }); })();