1// Bowman Fly Fishing â Lightbox Gallery 2(function() { 3 var lb = document.getElementById('lightbox'); 4 if (!lb) return; 5 var img = lb.querySelector('.lightbox-img'); 6 var counter = lb.querySelector('.lightbox-counter'); 7 var images = []; 8 var idx = 0; 9 10 function attach(selector, getSrc) { 11 var nodes = document.querySelectorAll(selector); 12 if (!nodes.length) return; 13 var groupImages = []; 14 nodes.forEach(function(node) { groupImages.push(getSrc(node)); }); 15 nodes.forEach(function(node, i) { 16 node.style.cursor = 'pointer'; 17 node.addEventListener('click', function() { 18 images = groupImages; 19 idx = i; 20 show(); 21 }); 22 }); 23 } 24 25 attach('.gallery-thumb', function(n) { return n.getAttribute('data-full'); }); 26 attach('.guide-lightbox', function(n) { return n.getAttribute('data-full'); }); 27 28 function show() { 29 img.src = images[idx]; 30 counter.textContent = (idx + 1) + ' / ' + images.length; 31 lb.classList.add('active'); 32 document.body.style.overflow = 'hidden'; 33 } 34 35 function hide() { 36 lb.classList.remove('active'); 37 document.body.style.overflow = ''; 38 } 39 40 lb.querySelector('.lightbox-close').addEventListener('click', hide); 41 lb.querySelector('.lightbox-prev').addEventListener('click', function(e) { 42 e.stopPropagation(); 43 idx = (idx - 1 + images.length) % images.length; 44 show(); 45 }); 46 lb.querySelector('.lightbox-next').addEventListener('click', function(e) { 47 e.stopPropagation(); 48 idx = (idx + 1) % images.length; 49 show(); 50 }); 51 lb.addEventListener('click', function(e) { 52 if (e.target === lb) hide(); 53 }); 54 document.addEventListener('keydown', function(e) { 55 if (!lb.classList.contains('active')) return; 56 if (e.key === 'Escape') hide(); 57 if (e.key === 'ArrowLeft') { idx = (idx - 1 + images.length) % images.length; show(); } 58 if (e.key === 'ArrowRight') { idx = (idx + 1) % images.length; show(); } 59 }); 60})();
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.