1(() => { 2 document.addEventListener('DOMContentLoaded', () => { 3 requestAnimationFrame(() => { 4 [...document.querySelectorAll('altcha-widget')].forEach((el) => { 5 // add the name attr to fix input validation exception 6 const altcha = el.querySelector('.altcha') 7 const checkbox = el.querySelector('input[type="checkbox"]') 8 checkbox?.setAttribute('name', ''); 9 const form = el.closest('form'); 10 if (form && checkbox && altcha?.getAttribute('data-state') !== 'code') { 11 form.addEventListener('submit', (ev) => { 12 if (altcha?.getAttribute('data-state') !== 'code' && !checkbox.reportValidity()) { 13 ev.preventDefault(); 14 ev.stopPropagation(); 15 } 16 }, true); 17 } 18 }); 19 20 // Removes duplicate widgets when manipulated with JS such as elementor popups and wpdiscuz 21 const observer = new MutationObserver((mutations) => { 22 [...document.querySelectorAll('altcha-widget')].forEach((el) => { 23 const altchas = [...el.querySelectorAll('.altcha')]; 24 if (altchas.length > 1) {
25 altchas.slice(0, -1).forEach((altcha) => altcha.remove()); 26 } 27 }) 28 }); 29 observer.observe(document.body, { 30 childList: true, 31 subtree: true, 32 }); 33 }); 34 }); 35})();
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.