Current Path : /storage/v11800/andslite-new/public_html/wp-content/cache/autoptimize/js/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/andslite-new/public_html/wp-content/cache/autoptimize/js/autoptimize_snippet_9a3cdb3f70a3d30e219d8a78eb525590.js |
(function($){'use strict';jQuery(document).ready(function(){var timer;var save_custom_email=cartbounty_co.save_custom_email;var custom_email_selectors=cartbounty_co.custom_email_selectors;var selector_timeout=cartbounty_co.selector_timeout;var contact_saved=localStorage.getItem('cartbounty_contact_saved');function getCheckoutData(){if(jQuery("#billing_email").length>0||jQuery("#billing_phone").length>0){var cartbounty_email=jQuery("#billing_email").val();if(typeof cartbounty_email==='undefined'||cartbounty_email===null){cartbounty_email='';}
var atposition=cartbounty_email.indexOf("@");var dotposition=cartbounty_email.lastIndexOf(".");var cartbounty_phone=jQuery("#billing_phone").val();if(typeof cartbounty_phone==='undefined'||cartbounty_phone===null){cartbounty_phone='';}
clearTimeout(timer);if(!(atposition<1||dotposition<atposition+2||dotposition+2>=cartbounty_email.length)||cartbounty_phone.length>4){var cartbounty_name=jQuery("#billing_first_name").val();var cartbounty_surname=jQuery("#billing_last_name").val();var cartbounty_phone=jQuery("#billing_phone").val();var cartbounty_country=jQuery("#billing_country").val();var cartbounty_city=jQuery("#billing_city").val();var cartbounty_billing_company=jQuery("#billing_company").val();var cartbounty_billing_address_1=jQuery("#billing_address_1").val();var cartbounty_billing_address_2=jQuery("#billing_address_2").val();var cartbounty_billing_state=jQuery("#billing_state").val();var cartbounty_billing_postcode=jQuery("#billing_postcode").val();var cartbounty_shipping_first_name=jQuery("#shipping_first_name").val();var cartbounty_shipping_last_name=jQuery("#shipping_last_name").val();var cartbounty_shipping_company=jQuery("#shipping_company").val();var cartbounty_shipping_country=jQuery("#shipping_country").val();var cartbounty_shipping_address_1=jQuery("#shipping_address_1").val();var cartbounty_shipping_address_2=jQuery("#shipping_address_2").val();var cartbounty_shipping_city=jQuery("#shipping_city").val();var cartbounty_shipping_state=jQuery("#shipping_state").val();var cartbounty_shipping_postcode=jQuery("#shipping_postcode").val();var cartbounty_order_comments=jQuery("#order_comments").val();var cartbounty_create_account=jQuery("#createaccount");var cartbounty_ship_elsewhere=jQuery("#ship-to-different-address-checkbox");if(cartbounty_create_account.is(':checked')){cartbounty_create_account=1;}else{cartbounty_create_account=0;}
if(cartbounty_ship_elsewhere.is(':checked')){cartbounty_ship_elsewhere=1;}else{cartbounty_ship_elsewhere=0;}
var data={action:"cartbounty_save",cartbounty_email:cartbounty_email,cartbounty_name:cartbounty_name,cartbounty_surname:cartbounty_surname,cartbounty_phone:cartbounty_phone,cartbounty_country:cartbounty_country,cartbounty_city:cartbounty_city,cartbounty_billing_company:cartbounty_billing_company,cartbounty_billing_address_1:cartbounty_billing_address_1,cartbounty_billing_address_2:cartbounty_billing_address_2,cartbounty_billing_state:cartbounty_billing_state,cartbounty_billing_postcode:cartbounty_billing_postcode,cartbounty_shipping_first_name:cartbounty_shipping_first_name,cartbounty_shipping_last_name:cartbounty_shipping_last_name,cartbounty_shipping_company:cartbounty_shipping_company,cartbounty_shipping_country:cartbounty_shipping_country,cartbounty_shipping_address_1:cartbounty_shipping_address_1,cartbounty_shipping_address_2:cartbounty_shipping_address_2,cartbounty_shipping_city:cartbounty_shipping_city,cartbounty_shipping_state:cartbounty_shipping_state,cartbounty_shipping_postcode:cartbounty_shipping_postcode,cartbounty_order_comments:cartbounty_order_comments,cartbounty_create_account:cartbounty_create_account,cartbounty_ship_elsewhere:cartbounty_ship_elsewhere}
timer=setTimeout(function(){jQuery.post(cartbounty_co.ajaxurl,data,function(response){if(response.success){localStorage.setItem('cartbounty_contact_saved',true);removeExitIntentForm();}});},800);}else{}}}
function saveCustomEmail(){var custom_email_selector=jQuery(this);var cartbounty_contact_saved=localStorage.getItem('cartbounty_contact_saved');if(cartbounty_contact_saved){return;}
if(jQuery(custom_email_selector).length>0&&!contact_saved){var cartbounty_custom_email=jQuery(custom_email_selector).val();if(typeof cartbounty_custom_email==='undefined'||cartbounty_custom_email===null){cartbounty_custom_email='';}
var atposition=cartbounty_custom_email.indexOf("@");var dotposition=cartbounty_custom_email.lastIndexOf(".");if(!(atposition<1||dotposition<atposition+2||dotposition+2>=cartbounty_custom_email.length)){if(cartbounty_custom_email!=''){localStorage.setItem('cartbounty_custom_email',cartbounty_custom_email);}}}}
function passCustomEmailToCartBounty(){var cartbounty_custom_email_stored=localStorage.getItem('cartbounty_custom_email');var cartbounty_contact_saved=localStorage.getItem('cartbounty_contact_saved');if(cartbounty_custom_email_stored==null||cartbounty_contact_saved){return;}
var data={action:"cartbounty_save",source:"cartbounty_custom_email",cartbounty_email:cartbounty_custom_email_stored}
jQuery.post(cartbounty_co.ajaxurl,data,function(response){if(response.success){localStorage.setItem('cartbounty_contact_saved',true);removeCustomEmailFields();removeExitIntentForm();}});}
function removeCustomEmailFields(){localStorage.removeItem('cartbounty_custom_email');}
function removeExitIntentForm(){if(jQuery('#cartbounty-exit-intent-form').length>0){jQuery('#cartbounty-exit-intent-form').remove();jQuery('#cartbounty-exit-intent-form-backdrop').remove();}}
jQuery('#billing_email, #billing_phone, input.input-text, input.input-checkbox, textarea.input-text').on('keyup keypress change',getCheckoutData);jQuery(window).on('load',getCheckoutData);if((save_custom_email&&!contact_saved)){passCustomEmailToCartBounty();setTimeout(function(){jQuery(custom_email_selectors).on('keyup keypress change',saveCustomEmail);},selector_timeout);jQuery(document).on('added_to_cart',passCustomEmailToCartBounty);}});})(jQuery);