1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 jQuery( document ).ready(function() { 32 // Only attempt reCAPTCHA rendering if grecaptcha is available (i.e., reCAPTCHA v2/v3 is selected) 33 if (typeof grecaptcha !== 'undefined' && typeof grecaptcha.render !== 'undefined' && ( typeof myCaptcha === 'undefined' || myCaptcha === null ) ) { 34 try{ 35 var myCaptcha=grecaptcha.render('g-recaptcha-checkout-wbc', { 36 'sitekey': bpRecaptcha.site_key, 37 'callback' : verifyCallback_add_guestcheckout 38 }); 39 }catch(error){ 40 console.log(error); 41 } 42 } 43 44 45 setTimeout(() => { 46 if ( 'yes' == bpRecaptcha.disable_submit_btn ){ 47 jQuery(".wc-block-components-checkout-place-order-button").attr("disabled", true); 48 jQuery(".wc-block-components-checkout-place-order-button").removeAttr("title"); 49 } 50 if ( 'yes' == bpRecaptcha.disable_submit_btn_login_checkout ){ 51 jQuery(".wc-block-components-checkout-place-order-button").attr("disabled", true); 52 } 53 }, 200); 54 55 56 57 }); 58 59 60 var verifyCallback_add_guestcheckout = function(response) { 61 62 if(response.length!==0){ 63 64 window.recap_val= response; 65 if (typeof woo_guest_checkout_recaptcha_verified === "function") { 66 67 woo_guest_checkout_recaptcha_verified(response); 68 } 69 70 if( 'yes' == wbc_recapcha_guest_recpacha_refersh_on_error ){ 71 jQuery('body').on('checkout_error', function(){ 72 grecaptcha.reset(window.myCaptcha); 73 if ( 'yes' == bpRecaptcha.disable_submit_btn ){ 74 jQuery(".wc-block-components-checkout-place-order-button").attr("disabled", true); 75 } 76 if ( 'yes' == bpRecaptcha.disable_submit_btn_login_checkout ){ 77 jQuery(".wc-block-components-checkout-place-order-button").attr("disabled", true); 78 } 79 }) 80 } 81 } 82 }; 83 84})( jQuery );
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.