1(() => { 2 const $ = (sel, root = document) => root.querySelector(sel); 3 4 const root = document.createElement("div"); 5 root.className = "ga-lightbox"; 6 root.hidden = true; 7 root.setAttribute("aria-hidden", "true"); 8 root.setAttribute("role", "dialog"); 9 root.setAttribute("aria-modal", "true"); 10 root.setAttribute("aria-label", "Bildansicht"); 11 root.innerHTML = ` 12 <div class="ga-lightbox__backdrop" data-ga-lightbox-close></div> 13 <div class="ga-lightbox__dialog"> 14 <button type="button" class="ga-lightbox__close" data-ga-lightbox-close>SchlieÃen</button> 15 <div class="ga-lightbox__stage"> 16 <img class="ga-lightbox__img" alt=""> 17 <div class="ga-lightbox__side"> 18 <p class="ga-lightbox__caption"></p> 19 <div class="ga-lightbox__info" hidden></div> 20 <p class="ga-lightbox__profile" hidden> 21 <a class="ga-lightbox__profile-link" href="#">Zum Künstlerprofil â</a> 22 </p> 23 </div> 24 </div> 25 </div> 26 `; 27 document.body.appendChild(root); 28 29 const dialog = $(".ga-lightbox__dialog", root); 30 const img = $(".ga-lightbox__img", root); 31 const caption = $(".ga-lightbox__caption", root); 32 const info = $(".ga-lightbox__info", root); 33 const profileWrap = $(".ga-lightbox__profile", root); 34 const profileLink = $(".ga-lightbox__profile-link", root); 35 const closeBtn = $(".ga-lightbox__close", root); 36 let lastFocus = null; 37 38 const clearInfo = () => { 39 info.textContent = ""; 40 info.hidden = true; 41 profileLink.href = "#"; 42 profileWrap.hidden = true; 43 dialog.classList.remove("ga-lightbox__dialog--artist"); 44 root.setAttribute("aria-label", "Bildansicht"); 45 }; 46 47 const resolveInfo = (btn) => { 48 let text = (btn.getAttribute("data-info") || "").trim(); 49 let profile = (btn.getAttribute("data-profile") || "").trim(); 50 const artistId = (btn.getAttribute("data-artist") || "").trim(); 51 52 if (artistId) { 53 const bioEl = document.querySelector( 54 '[data-ga-artist-bio="' + artistId + '"]' 55 ); 56 if (bioEl) { 57 if (!text) { 58 const bioText = bioEl.querySelector(".ga-shop__artist-bio-text"); 59 if (bioText) text = (bioText.textContent || "").trim(); 60 } 61 if (!profile) { 62 const link = bioEl.querySelector(".ga-shop__artist-bio-link a"); 63 if (link && link.href) profile = link.href; 64 } 65 } 66 } 67 68 return { text, profile }; 69 }; 70 71 const close = () => { 72 if (root.hidden) return; 73 root.hidden = true; 74 root.setAttribute("aria-hidden", "true"); 75 img.removeAttribute("src"); 76 img.alt = ""; 77 caption.textContent = ""; 78 clearInfo(); 79 document.body.classList.remove("ga-lightbox-open"); 80 document.removeEventListener("keydown", onKey); 81 if (lastFocus && typeof lastFocus.focus === "function") { 82 lastFocus.focus(); 83 } 84 lastFocus = null; 85 }; 86 87 const onKey = (e) => { 88 if (e.key === "Escape") { 89 e.preventDefault(); 90 close(); 91 return; 92 } 93 if (e.key !== "Tab") return; 94 e.preventDefault(); 95 closeBtn?.focus(); 96 }; 97 98 const open = (btn) => { 99 const src = btn.getAttribute("data-src"); 100 if (!src) return; 101 lastFocus = btn; 102 img.src = src; 103 img.alt = btn.getAttribute("data-alt") || ""; 104 caption.textContent = btn.getAttribute("data-caption") || ""; 105 106 const resolved = resolveInfo(btn); 107 if (resolved.text) { 108 info.textContent = resolved.text; 109 info.hidden = false; 110 dialog.classList.add("ga-lightbox__dialog--artist"); 111 root.setAttribute( 112 "aria-label", 113 ((window.GLOWART && window.GLOWART.i18n) || {}).portraitAria || "Künstlerporträt und Infotext" 114 ); 115 } else { 116 clearInfo(); 117 } 118 119 if (resolved.profile) { 120 profileLink.href = resolved.profile; 121 profileWrap.hidden = false; 122 dialog.classList.add("ga-lightbox__dialog--artist"); 123 } else { 124 profileLink.href = "#"; 125 profileWrap.hidden = true; 126 } 127 128 root.hidden = false; 129 root.setAttribute("aria-hidden", "false"); 130 root.removeAttribute("data-borlabs-cookie-aria-hidden"); 131 document.body.classList.add("ga-lightbox-open"); 132 document.addEventListener("keydown", onKey);
133 closeBtn?.focus(); 134 }; 135 136 document.addEventListener("click", (e) => { 137 const trigger = e.target.closest("[data-ga-lightbox]"); 138 if (trigger) { 139 e.preventDefault(); 140 e.stopPropagation(); 141 open(trigger); 142 return; 143 } 144 if (e.target.closest("[data-ga-lightbox-close]")) { 145 close(); 146 } 147 }); 148})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.