1jQuery(document).ready(function ($) { 2 3 // display age based on the coockie on the checkout page start 4 var agegate_birthdate_cookie = ($.cookie("agegate_birthdate_cookie")); 5 jQuery('#date_of_birth_field label span.age_response').html(agegate_birthdate_cookie); 6 // display age based on the coockie on the checkout page end 7 8 $('#agc_verify_form select').change( function() { 9 var flag = false; 10 $('#agc_verify_form select').each(function(){ 11 var val = $(this).val(); 12 13 if( val == null || val == '' || typeof val == 'undefined'){ 14 flag = true; 15 } 16 }); 17 if( flag == false ){ 18 $('.agc_verify_button').removeAttr('disabled'); 19 } else { 20 $('.agc_verify_button').attr('disabled','disabled'); 21 } 22 }); 23 //When change country 24 $('#age_limit_country').change( function() { 25 $('.agc_result').remove(); 26 var pathName = ''; 27 if( top.location.pathname ){ 28 pathName = top.location.pathname; 29 } 30 if( $(this).val() == 'CA') { 31 $( '#agc_verify_submit' ).append( '<div class="agc_result redirect">Redirecting you to https://arizer.ca...</div>' ); 32 window.location = 'https://arizer.ca'+pathName; 33 } else if( $(this).val() == 'US') { 34 $( '#agc_verify_submit' ).append( '<div class="agc_result redirect">Redirecting you to https://arizer.com...</div>' ); 35 window.location = 'https://arizer.com'+pathName; 36 } else if( $(this).val() == 'AT') { 37 $( '#agc_verify_submit' ).append( '<div class="agc_result redirect">Redirecting you to https://arizer.eu/de...</div>' ); 38 window.location = 'https://arizer.eu/de'+pathName; 39 } else if( $(this).val() == 'GB') { 40 $( '#agc_verify_submit' ).append( '<div class="agc_result redirect">Redirecting you to https://arizeruk.com...</div>' ); 41 window.location = 'https://arizeruk.com'+pathName; 42 } else { 43 $( '#agc_verify_submit' ).append( '<div class="agc_result redirect">Redirecting you to https://arizer.net...</div>' ); 44 window.location = 'https://arizer.net'+pathName; 45 } 46 47 }); 48 49 //On change of state display DOB and submit fields 50 $('#age_limit_state').change( function(e){ 51 if($(this).val() == 'allstates') 52 { 53 $('.age-gate__info').hide(); 54 } else { 55 $('.age-gate__info').show(); 56 } 57 }); 58 59 // On state change age validation on .CA site start 60 jQuery(".agegate_check_validation").change(function() { 61 if(this.checked) { 62 jQuery('.agc_verify_button').removeAttr('disabled'); 63 } else { 64 jQuery('.agc_verify_button').attr('disabled','disabled'); 65 } 66 }); 67 68 $('#age_limit_state').change( function(e){ 69 if($(this).val() == 'allstates') 70 { 71 $('.age-gate__info').hide(); 72 } else { 73 $('.age-gate__info').show(); 74 var site_id = jQuery(".current_site_id").val(); 75 var selected_country = jQuery('#age_limit_country').find(":selected").val(); 76 var selected_state = jQuery('#age_limit_state').find(":selected").val(); 77 jQuery('.agc_verify_button').attr('disabled', 'disabled'); 78 jQuery('.agegate_check_validation').prop('checked', false); 79 80 81 if(site_id == 2 ) { 82 jQuery.ajax({ 83 url : check_age_limit.ajax_url, 84 dataType: 'json', 85 type: 'POST', 86 data: { 87 action: 'check_age_limit', 88 selected_country: selected_country, 89 selected_state: selected_state, 90 site_id: site_id, 91 }, 92 success : function( response ) { 93 jQuery( '#agc_dob .agegate_state_validation .age_response' ).html(response); 94 Cookies.set('agegate_birthdate_cookie', response); 95 } 96 }); 97 } 98 } 99 }); 100 101 var site_id = jQuery(".current_site_id").val(); 102 var selected_country = jQuery('#age_limit_country').find(":selected").val(); 103 104 jQuery.ajax({ 105 url: check_age_limit.ajax_url, 106 dataType: 'json', 107 type: 'POST', 108 data: { 109 action: 'check_age_limit', 110 selected_country: selected_country, 111 site_id: site_id, 112 }, 113 success: function (response) { 114 jQuery('#agc_dob .agegate_state_validation .age_response').html(response); 115 Cookies.set('agegate_birthdate_cookie', response); 116 } 117 }); 118 // On state change age validation on .CA site end 119 120 $( 'body' ).on( 'submit', '#agc_verify_form', function(event) { 121 event.preventDefault(); 122 var form = $( this ); 123 form.find( '.agc_result' ).remove(); 124 $.ajax({ 125 type: "POST", 126 url: agc.admin_ajax, 127 data: form.serialize(), 128 cache: false, 129 success: function (result) { 130 try { 131 result = jQuery.parseJSON( result ); 132 if ( result['result'] == 'success' ) { 133 $( 'html, body' ).removeClass( 'agc_no_scroll' ); 134 $( '.agc_screen' ).remove(); 135 } 136 else if ( result['result'] == 'validate' ) { 137 $( '#agc_verify_submit' ).append( '<div class="agc_result"><span class="agc_icon_exclamation_circle"></span> ' + result['output'] + '</div>' ); 138 } 139 else { 140 throw 0; 141 } 142 } 143 catch(err) { 144 $( '#agc_verify_submit' ).append( '<div class="agc_result"><span class="agc_icon_exclamation_circle"></span> Failed, please try again.</div>' ); 145 } 146 } 147 }); 148 }); 149});
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.