1/******* Do not edit this file ******* 2Simple Custom CSS and JS - by Silkypress.com 3Saved: Mar 19 2026 | 12:26:35 */ 4document.addEventListener("DOMContentLoaded", function () { 5 document.querySelectorAll(".tab-supplier .elementor-widget-form").forEach(function (widget) { 6 const form = widget.querySelector("form.elementor-form"); 7 if (!form) return; 8 9 // evita conflito com o fluxo customizado do formulário de patrocÃnio 10 if (form.getAttribute("name") === "Patrocinio") return; 11 12 const sectionForm = widget.closest(".section-form"); 13 const formWrapper = widget.closest(".form_abas"); 14 const titleForm = sectionForm ? sectionForm.querySelector(".title-form") : null; 15 const fieldsWrap = form.querySelector(".elementor-form-fields-wrapper"); 16 17 if (!sectionForm || !fieldsWrap) return; 18 19 let successTimer = null; 20 let successVisible = false; 21 let watchInterval = null; 22 23 function getNativeSuccessMessage() { 24 return form.querySelector(".elementor-message.elementor-message-success"); 25 } 26 27 function removeCustomMessage() { 28 widget.querySelectorAll(".form-std-success-box").forEach(function (el) { 29 el.remove(); 30 }); 31 } 32 33 function hideNativeSuccessMessage() { 34 const nativeMsg = getNativeSuccessMessage(); 35 if (nativeMsg) { 36 nativeMsg.style.display = "none"; 37 } 38 } 39 40 function scrollToTop() { 41 const target = formWrapper || sectionForm || widget; 42 if (!target) return; 43 44 const top = target.getBoundingClientRect().top + window.pageYOffset - 24; 45 46 window.scrollTo({ 47 top: top, 48 behavior: "smooth" 49 }); 50 } 51 52 function restoreForm() { 53 removeCustomMessage(); 54 hideNativeSuccessMessage(); 55 56 fieldsWrap.style.display = ""; 57 if (titleForm) titleForm.style.display = ""; 58 59 successVisible = false; 60 61 if (typeof form.reset === "function") { 62 form.reset(); 63 } 64 65 setTimeout(scrollToTop, 100); 66 } 67 68 function showCustomSuccess() { 69 if (successVisible) return; 70 successVisible = true; 71 72 const nativeMsg = getNativeSuccessMessage(); 73 const successText = 74 nativeMsg && nativeMsg.textContent.trim() 75 ? nativeMsg.textContent.trim() 76 : "Sua mensagem foi enviada com sucesso."; 77 78 hideNativeSuccessMessage(); 79 removeCustomMessage(); 80 81 fieldsWrap.style.display = "none"; 82 if (titleForm) titleForm.style.display = "none"; 83 84 const box = document.createElement("div"); 85 box.className = "form-std-success-box"; 86 box.style.cssText = ` 87 display:flex; 88 flex-direction:column; 89 align-items:center; 90 justify-content:center; 91 text-align:center; 92 width:100%; 93 min-height:220px; 94 padding:40px 20px; 95 `; 96 97 const title = document.createElement("h2"); 98 title.textContent = "OBRIGADO PELO ENVIO!"; 99 title.style.cssText = ` 100 margin:0 0 12px 0; 101 color:#00444c; 102 `; 103 104 const text = document.createElement("p"); 105 text.textContent = successText; 106 text.style.cssText = ` 107 margin:0; 108 color:#31e774; 109 font-weight:600; 110 font-size:1.05rem; 111 `; 112 113 box.appendChild(title); 114 box.appendChild(text); 115 116 widget.appendChild(box); 117 118 setTimeout(scrollToTop, 100); 119 120 clearTimeout(successTimer); 121 successTimer = setTimeout(restoreForm, 15000); 122 } 123 124 function successIsVisible() { 125 const nativeMsg = getNativeSuccessMessage(); 126 if (!nativeMsg) return false; 127 128 const style = window.getComputedStyle(nativeMsg); 129 130 return ( 131 nativeMsg.textContent.trim() !== "" && 132 style.display !== "none" && 133 style.visibility !== "hidden" && 134 style.opacity !== "0" 135 ); 136 } 137 138 function startWatchingSuccess() { 139 clearInterval(watchInterval); 140 141 let tries = 0; 142 143 watchInterval = setInterval(function () { 144 tries++; 145 146 if (successIsVisible()) { 147 clearInterval(watchInterval); 148 watchInterval = null; 149 showCustomSuccess(); 150 return; 151 } 152 153 if (tries > 100) { 154 clearInterval(watchInterval); 155 watchInterval = null; 156 } 157 }, 150); 158 } 159 160 function checkSuccess() { 161 if (successIsVisible()) { 162 setTimeout(showCustomSuccess, 50); 163 } 164 } 165 166 const observer = new MutationObserver(checkSuccess); 167 168 observer.observe(widget, { 169 childList: true, 170 subtree: true, 171 attributes: true, 172 attributeFilter: ["style", "class"] 173 });
174 175 form.addEventListener( 176 "submit", 177 function () { 178 setTimeout(startWatchingSuccess, 200); 179 }, 180 true 181 ); 182 183 if (window.jQuery) { 184 window.jQuery(form).on("submit_success", function () { 185 setTimeout(showCustomSuccess, 50); 186 }); 187 } 188 }); 189});
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.