1(function () { 2 'use strict'; 3 4 var modal = document.getElementById('nczd-emergency-modal'); 5 if (!modal) { 6 return; 7 } 8 9 var openers = document.querySelectorAll('[data-nczd-emergency-open]'); 10 var closers = modal.querySelectorAll('[data-nczd-emergency-close]'); 11 var lastFocus = null; 12 13 function openModal() { 14 lastFocus = document.activeElement; 15 modal.hidden = false; 16 document.body.classList.add('nczd-emergency-open'); 17 var closeBtn = modal.querySelector('.nczd-emergency-modal__close'); 18 if (closeBtn) { 19 closeBtn.focus(); 20 } 21 } 22 23 function closeModal() { 24 modal.hidden = true; 25 document.body.classList.remove('nczd-emergency-open'); 26 if (lastFocus && typeof lastFocus.focus === 'function') { 27 lastFocus.focus(); 28 } 29 } 30 31 openers.forEach(function (button) { 32 button.addEventListener('click', openModal); 33 }); 34 35 closers.forEach(function (button) { 36 button.addEventListener('click', closeModal); 37 }); 38 39 document.addEventListener('keydown', function (event) { 40 if (event.key === 'Escape' && !modal.hidden) { 41 closeModal(); 42 } 43 }); 44})();
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.