1(() => { 2 document.addEventListener("BaselineLoaded", () => { 3 document.querySelectorAll(".contact-component").forEach((component) => { 4 const options = component.querySelectorAll( 5 ".contact-component__option[data-form-index]" 6 ); 7 const forms = component.querySelectorAll(".contact-component__form"); 8 9 const closeWithAnimation = (form) => { 10 form.classList.remove("visible"); 11 form.classList.add("closing"); 12 setTimeout(() => form.classList.remove("closing"), 300); 13 }; 14 15 const closeInstant = (form) => { 16 form.classList.remove("visible", "closing"); 17 }; 18 19 const untoggleOption = (index) => { 20 component 21 .querySelector(`.contact-component__option[data-form-index="${index}"]`) 22 ?.classList.remove("toggled"); 23 }; 24 25 options.forEach((option) => { 26 option.addEventListener("click", (e) => { 27 e.preventDefault(); 28 29 const targetIndex = option.dataset.formIndex; 30 const targetForm = component.querySelector( 31 `.contact-component__form[data-form-index="${targetIndex}"]` 32 ); 33 if (!targetForm) return; 34 35 const openForm = component.querySelector( 36 ".contact-component__form.visible" 37 ); 38 39 // Checks for not having a double form for 300ms 40 if (openForm && openForm === targetForm) { 41 closeWithAnimation(openForm); 42 option.classList.remove("toggled"); 43 return; 44 } 45 46 if (openForm && openForm !== targetForm) { 47 const openIndex = openForm.dataset.formIndex; 48 closeInstant(openForm); 49 untoggleOption(openIndex); 50 } 51 52 targetForm.classList.add("visible"); 53 option.classList.add("toggled"); 54 }); 55 }); 56 }); 57 }); 58})();
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.