1const handleFLDConsentForm = (() => { 2 const root = document.querySelector("#fld-cookie-consent-root"); 3 const hasConsentedCookieName = "fld-cookie-has-consented"; 4 const hasConsented = checkCookie(hasConsentedCookieName); 5 const floatingCookieButton = document.querySelector( 6 ".floating-cookie-button" 7 ); 8 9 if (floatingCookieButton) { 10 floatingCookieButton.addEventListener("click", () => { 11 root.classList.add("show"); 12 }); 13 } 14 15 if (root && hasConsented) { 16 root.classList.remove("show"); 17 } 18 19 const acceptAllCookies = async (cookie_types, hash) => 20 $.ajax({ 21 url: ajax_object.ajax_url, 22 type: "POST", 23 data: { 24 action: "accept_all_cookies", 25 cookie_types, 26 hash, 27 }, 28 success: (response) => response, 29 error: (error) => false, 30 }); 31 32 const setConsentCookies = (hash, response) => { 33 setCookie("fldCookieConsentHash", hash, 7); 34 setCookie("fldCookieConsentUUID", response.uuid, 7); 35 setCookie("fldCookieConsentGiven", response.term_ids.join(",")); 36 }; 37 38 if (root) { 39 const acceptAll = root.querySelector("#accept-all"); 40 const confirmChoices = root.querySelector("#confirm-choices"); 41 const hash_input = root.querySelector("input[name='hash']"); 42 const hash = hash_input.value; 43 const showMoreButtons = Array.from(root.querySelectorAll(".show-cookies")); 44 const hashCookie = getCookieValue("fldCookieConsentHash"); 45 const consentsGiven = getCookieValue("fldCookieConsentGiven") ?? false; 46 const formInputs = Array.from( 47 root.querySelectorAll("input.cookie-options") 48 ); 49 50 if (consentsGiven) { 51 const consents = consentsGiven.split(","); 52 consents.forEach((c) => { 53 const target = document.querySelector(`#cookie-type-${c}`); 54 if (target) { 55 target.checked = true; 56 } 57 }); 58 } else { 59 formInputs.forEach((i) => (i.checked = true)); 60 } 61 62 if (hash !== hashCookie || !hashCookie) { 63 setTimeout(() => { 64 root.classList.add("show"); 65 }, 3000); 66 } 67 68 if (hashCookie === hash) { 69 root.classList.add("see-more-clicked"); 70 } 71 72 acceptAll.addEventListener("click", async () => { 73 const cookie_type_checkboxes = Array.from( 74 root.querySelectorAll("input[type='checkbox']") 75 ); 76 const types = cookie_type_checkboxes.map((c) => c.value).join(","); 77 const response = await acceptAllCookies(types, hash); 78 79 setConsentCookies(hash, response); 80 root.classList.remove("show"); 81 }); 82 83 confirmChoices.addEventListener("click", async () => { 84 const cookie_type_checkboxes = Array.from( 85 root.querySelectorAll("input[type='checkbox']:checked") 86 ); 87 const types = cookie_type_checkboxes.map((c) => c.value).join(","); 88 const response = await acceptAllCookies(types, hash); 89 90 setConsentCookies(hash, response); 91 root.classList.remove("show"); 92 }); 93 94 showMoreButtons.forEach((button) => { 95 button.addEventListener("click", (e) => { 96 e.preventDefault(); 97 button.parentElement.nextElementSibling.classList.toggle("show"); 98 }); 99 }); 100 } 101})();
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.