1 /* @v2-checkbox-js:start */ 2 var c4wp_onloadCallback = function() { 3 for (var i = 0; i < document.forms.length; i++) { 4 let form = document.forms[i]; 5 6 let captcha_div = form.querySelector('.c4wp_captcha_field_div:not(.rendered)'); 7 let foundSubmitBtn = null; 8 if (c4wpConfig.disable_submit == 1) { 9 foundSubmitBtn = form.querySelector('[type=submit]'); 10 } 11 12 if (null === captcha_div) { 13 continue; 14 } 15 16 captcha_div.innerHTML = ''; 17 18 if (null != foundSubmitBtn) { 19 foundSubmitBtn.classList.add('disabled'); 20 foundSubmitBtn.setAttribute('disabled', 'disabled'); 21 22 if (form.classList.contains('woocommerce-checkout')) { 23 setTimeout(function() { 24 foundSubmitBtn = form.querySelector('#place_order'); 25 foundSubmitBtn.classList.add('disabled'); 26 foundSubmitBtn.setAttribute('disabled', 'disabled'); 27 }, 2500); 28 } 29 } 30 31 (function(form) { 32 var c4wp_captcha = grecaptcha.render(captcha_div, { 33 'sitekey': c4wpConfig.site_key, 34 'size': c4wpConfig.size, 35 'theme': c4wpConfig.theme, 36 'expired-callback': function() { 37 grecaptcha.reset(c4wp_captcha); 38 }, 39 'callback': function(token) { 40 if (null != foundSubmitBtn) { 41 foundSubmitBtn.classList.remove('disabled'); 42 foundSubmitBtn.removeAttribute('disabled'); 43 } 44 if (typeof jQuery !== 'undefined' && jQuery('input[id*="c4wp-wc-checkout"]').length) { 45 let input = document.querySelector('input[id*="c4wp-wc-checkout"]'); 46 let lastValue = input.value; 47 input.value = token; 48 let event = new Event('input', { 49 bubbles: true 50 }); 51 event.simulated = true; 52 let tracker = input._valueTracker; 53 if (tracker) { 54 tracker.setValue(lastValue); 55 } 56 input.dispatchEvent(event) 57 } 58 } 59 }); 60 captcha_div.classList.add('rendered'); 61 62 eval(c4wpConfig.additional_js); 63 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 64 65 })(form); 66 } 67 }; 68 69 window.addEventListener("load", (event) => { 70 if (typeof jQuery !== 'undefined' && jQuery('input[id*="c4wp-wc-checkout"]').length) { 71 var element = document.createElement('div'); 72 var html = c4wpConfig.field_markup; 73 element.innerHTML = html; 74 jQuery('[class*="c4wp-wc-checkout"]').append(element); 75 jQuery('[class*="c4wp-wc-checkout"]').find('*').off(); 76 c4wp_onloadCallback(); 77 } 78 }); 79 /* @v2-checkbox-js:end */
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.