1document.addEventListener('DOMContentLoaded', function() { 2 const $toggleElements = document.querySelectorAll('#amprivacy-checkbox a, #amprivacy-popup .cross'); 3 const $policyButton = document.querySelector('[data-role="accept-policy"]'); 4 const $popup = document.getElementById('amprivacy-popup'); 5 6 if (!$popup) { 7 return; 8 } 9 10 const togglePrivacyPopup = (event) => { 11 event.preventDefault(); 12 event.stopPropagation(); 13 $popup.style.display = ($popup.style.display === 'none' ) ? '' : 'none'; 14 } 15 16 const closePrivacyPopup = () => { 17 $popup.style.display = 'none'; 18 } 19 20 const acceptPolicy = (event) => { 21 const $checkboxes = document.querySelectorAll('#amprivacy-checkbox input[type="checkbox"]'); 22 23 $checkboxes.forEach(checkbox => { 24 checkbox.checked = true; 25 checkbox.dispatchEvent(new Event('change')); 26 }); 27 28 togglePrivacyPopup(event); 29 } 30 31 const handleEscapeKey = (event) => { 32 if (event.key === 'Escape') { 33 closePrivacyPopup(); 34 } 35 } 36 37 const handleOutsideClick = (event) => { 38 if ($popup && !event.target.closest('.c-amprivacy-policy__popup')) { 39 closePrivacyPopup(); 40 } 41 } 42 43 $toggleElements.forEach(function(toggleElement) { 44 toggleElement.addEventListener('click', togglePrivacyPopup); 45 }); 46 47 document.addEventListener('keydown', handleEscapeKey); 48 document.addEventListener('click', handleOutsideClick); 49 50 if ($policyButton) { 51 $policyButton.addEventListener('click', acceptPolicy); 52 } 53 54});
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.