1function isCaptchaEnabled() { 2 if (typeof recaptcha_data !== 'undefined' && typeof recaptcha_data.enabled !== 'undefined') { 3 return recaptcha_data.enabled === true || recaptcha_data.enabled === '1' || recaptcha_data.enabled === 1; 4 } 5 6 const host = window.location.hostname.toLowerCase(); 7 return host === 'qualicorp.com.br' || host === 'www.qualicorp.com.br'; 8} 9 10function hideCaptchaWidgets() { 11 const widgets = document.querySelectorAll('#g-recaptcha, .gReCaptcha'); 12 13 Array.from(widgets).forEach(function (widget) { 14 widget.style.display = 'none'; 15 16 const sibling = widget.nextElementSibling; 17 if (!sibling) { 18 return; 19 } 20 21 // Erro direto ao lado do widget 22 if (sibling.classList.contains('error')) { 23 sibling.style.display = 'none'; 24 return; 25 } 26 27 // Markup da Ouvidoria: <div id="g-recaptcha"></div><p><span class="error"> 28 if (sibling.querySelector && sibling.querySelector('.error')) { 29 sibling.style.display = 'none'; 30 } 31 }); 32} 33 34function renderCaptacha() { 35 if (!isCaptchaEnabled()) { 36 hideCaptchaWidgets(); 37 return; 38 } 39 40 if (typeof grecaptcha === 'undefined') { 41 return; 42 } 43 44 grecaptcha.ready(function () { 45 const captchaElement = document.getElementById('g-recaptcha'); 46 47 if (captchaElement && !captchaElement.dataset.rendered) { 48 grecaptcha.render('g-recaptcha', { 49 sitekey: recaptcha_data.key 50 }); 51 captchaElement.dataset.rendered = '1'; 52 return; 53 } 54 55 const container = document.querySelector('.gReCaptcha'); 56 57 if (container && !container.dataset.rendered) { 58 grecaptcha.render(container, { 59 sitekey: recaptcha_data.key 60 }); 61 container.dataset.rendered = '1'; 62 } 63 }); 64} 65 66function validateCaptcha() { 67 if (!isCaptchaEnabled()) { 68 return true; 69 } 70 71 if (typeof grecaptcha === 'undefined') { 72 return false; 73 } 74 75 try { 76 const response = grecaptcha.getResponse(); 77 return response.length > 0; 78 } catch (error) { 79 return false; 80 } 81} 82 83document.addEventListener('DOMContentLoaded', function () { 84 if (!isCaptchaEnabled()) { 85 hideCaptchaWidgets(); 86 return; 87 } 88 89 renderCaptacha(); 90});
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.