PageSourceSearch

https://field-map.com/js/lightbox-lite.js

js field-map.com collected 2026-10-08 15:25:49 UTC 1,607 bytes, 52 lines download raw bytes

1(function(){
2  'use strict';
3
4  function isLightboxLink(a){
5    if(!a) return false;
6    var rel=(a.getAttribute('rel')||'').toLowerCase();
7    var cls=(a.getAttribute('class')||'').toLowerCase();
8    return rel.indexOf('lightbox')!==-1 || cls.indexOf('lightbox')!==-1;
9  }
10
11  function ensureOverlay(){
12    var o=document.getElementById('fmLightbox');
13    if(o) return o;
14    o=document.createElement('div');
15    o.id='fmLightbox';
16    o.className='fm-lightbox';
17    o.innerHTML="<button type=\"button\" class=\"fm-lightbox__close\" aria-label=\"Close\">×</button><img class=\"fm-lightbox__img\" alt=\"\">";
18    document.body.appendChild(o);
19    o.addEventListener('click', function(ev){
20      if(ev.target===o || ev.target.classList.contains('fm-lightbox__close')) closeOverlay();
21    });
22    document.addEventListener('keydown', function(ev){ if(ev.key==='Escape') closeOverlay(); });
23    return o;
24  }
25
26  function openOverlay(src){
27    var o=ensureOverlay();
28    var img=o.querySelector('img');
29    img.src=src;
30    o.classList.add('fm-lightbox--open');
31  }
32
33  function closeOverlay(){
34    var o=document.getElementById('fmLightbox');
35    if(!o) return;
36    o.classList.remove('fm-lightbox--open');
37    var img=o.querySelector('img');
38    if(img) img.src='';
39  }
40
41  document.addEventListener('click', function(ev){
42    var el=ev.target;
43    while(el && el!==document && el.tagName!=='A') el=el.parentNode;
44    if(!el || el.tagName!=='A') return;
45    if(!isLightboxLink(el)) return;
46    var href=el.getAttribute('href');
47    if(!href) return;
48    ev.preventDefault();
49    openOverlay(href);
50  });
51
52})();

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.