1// ------------------------------------------------------------------------------------------- 2// 3// Checks if we need to load the recaptcha script on a page 4// 5// ------------------------------------------------------------------------------------------- 6 7(function($) 8{ 9 "use strict"; 10 11 // Remove not needed messages from forms 12 $('form.avia_ajax_form.avia-mailchimp-form').find('.avia-disabled-form').remove(); 13 14 if( $( '#avia-google-recaptcha-api-script' ).length > 0 ) 15 { 16 return; 17 } 18 19 if( 'undefined' == typeof AviaReCAPTCHA_front || 'undefined' == typeof AviaReCAPTCHA_front.avia_api_script ) 20 { 21 return; 22 } 23 24 if( ! $('body').hasClass('av-recaptcha-enabled') ) 25 { 26 return; 27 } 28 29 /* check if reCaptcha are disabled by user setting via cookie - or user must opt in. */ 30 var cookie_check = $('html').hasClass('av-cookies-needs-opt-in') || $('html').hasClass('av-cookies-can-opt-out'); 31 var allow_continue = true; 32 var silent_accept_cookie = $('html').hasClass('av-cookies-user-silent-accept'); 33 34 if( cookie_check && ! silent_accept_cookie ) 35 { 36 if( ! document.cookie.match(/aviaCookieConsent/) || $('html').hasClass('av-cookies-session-refused') ) 37 { 38 allow_continue = false; 39 } 40 else 41 { 42 if( ! document.cookie.match(/aviaPrivacyRefuseCookiesHideBar/) ) 43 { 44 allow_continue = false; 45 } 46 else if( ! document.cookie.match(/aviaPrivacyEssentialCookiesEnabled/) ) 47 { 48 allow_continue = false; 49 } 50 else if( document.cookie.match(/aviaPrivacyGoogleReCaptchaDisabled/) ) 51 { 52 allow_continue = false; 53 } 54 } 55 } 56 57 if( ! allow_continue ) 58 { 59 var forms = $( 'form.avia_ajax_form' ).not( '.avia-mailchimp-form' ); 60 var recaptchas = forms.find( '.avia-disabled-form' ).closest( 'form.avia_ajax_form' ); 61 recaptchas.addClass( 'av-form-user-disabled' ); 62 recaptchas.find( 'input.button' ).remove(); 63 64 return; 65 } 66 67 var version = AviaReCAPTCHA_front.version; 68 var recaptcha_areas = $('div.av-recaptcha-area'); 69 70 if( recaptcha_areas.length == 0 && version != 'avia_recaptcha_v3' ) 71 { 72 return; 73 } 74 75 var script = document.createElement('script'); 76 script.id = 'avia-google-recaptcha-api-script'; 77 script.type = 'text/javascript'; 78 script.src = AviaReCAPTCHA_front.avia_api_script; 79 80 document.body.appendChild( script ); 81 82 83})( jQuery ); 84
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.