1;(function($, window, document, undefined){ 2 var AuxinRemoveCartContent = function() { 3 // Remove cart content 4 $(document).on( 'click', '.aux-remove-cart-content', function(e) { 5 e.preventDefault(); 6 7 var product_id = $(this).data("product_id"); 8 var cart_item_key= $(this).data("cart_item_key"); 9 var verify_nonce = $(this).data("verify_nonce"); 10 var $cartBoxEl = $(this).closest('.aux-cart-wrapper').addClass('aux-cart-remove-in-progress'); 11 12 $.ajax({ 13 type: 'POST', 14 dataType: 'json', 15 url: auxin.ajax_url, 16 data: { 17 action: "auxels_remove_from_cart", 18 product_id: product_id, 19 cart_item_key: cart_item_key, 20 verify_nonce: verify_nonce, 21 }, 22 success: function( response ){ 23 // Remove old notification 24 $(".woocommerce-message, .woocommerce-error").remove(); 25 // Start Notifications 26 if( response.success ) { 27 $('.aux-hidden-blocks').append( response.data.notif ); 28 29 if( parseInt(response.data.total) === 0 ) { 30 $('.aux-card-dropdown').html(response.data.empty); 31 $('.aux-cart-contents').find('span').remove(); 32 } else { 33 $('.aux-card-item').filter(function(){ 34 return $(this).data('cart_item_key') == cart_item_key; 35 }).remove(); 36 $('.aux-cart-contents').find('span').text(response.data.count); 37 } 38 $(".aux-cart-subtotal").each(function() { 39 $(this).find('.woocommerce-Price-amount').html(response.data.total); 40 }); 41 $cartBoxEl.removeClass('aux-cart-remove-in-progress'); 42 } else { 43 $('.aux-hidden-blocks').append( response.data ); 44 } 45 } 46 }); 47 48 }); 49 }; 50 51 var AuxinAjaxAddToCart = function() { 52 // Add Content to Cart 53 $(document).on( 'click', '.aux-ajax-add-to-cart', function(e) { 54 var productType = $(this).data("product-type"); 55 56 if ( productType !== 'simple' ) { 57 return; 58 } 59 60 if ( typeof auxin_cart_options === 'undefined' ) { 61 auxin_cart_options = ''; 62 } 63 64 e.preventDefault(); 65 66 var product_id = $(this).data("product_id"); 67 var quantity = $(this).data("quantity"); 68 var verify_nonce = $(this).data("verify_nonce"); 69 var $cartBoxEl = $('.aux-cart-wrapper'); 70 var hasAnimation = $cartBoxEl.hasClass('aux-basket-animation') ? true : false; 71 72 $cartBoxEl.trigger('AuxCartInProgress'); 73 74 if ( $(this).parents('.aux-shop-quicklook-modal') ) { 75 quantity = $(this).parents('.aux-shop-quicklook-modal').find('.quantity input').val(); 76 } 77 78 $.ajax({ 79 type: 'POST', 80 dataType: 'json', 81 url: auxin.ajax_url, 82 data: { 83 action : "auxels_add_to_cart", 84 args : auxin_cart_options, 85 product_id : product_id, 86 quantity : quantity, 87 verify_nonce: verify_nonce 88 }, 89 success: function( response ){ 90 // Remove old notification 91 $(".woocommerce-message, .woocommerce-error").remove(); 92 // Start Notifications 93 if( response.success ) { 94 $('.aux-hidden-blocks').append( response.data.notif ); 95 96 setTimeout( function(){ 97 if ( hasAnimation ) { 98 // $cartBoxEl.on('AuxCartProgressAnimationDone', function(e) { 99 $cartBoxEl.find('.aux-card-dropdown').html( response.data.items ); 100 $cartBoxEl.find('.aux-shopping-basket').html( response.data.total ); 101 $cartBoxEl.trigger('AuxCartUpdated'); 102 // }); 103 } else { 104 $cartBoxEl.find('.aux-card-dropdown').html( response.data.items ); 105 $cartBoxEl.find('.aux-shopping-basket').html( response.data.total ); 106 $cartBoxEl.trigger('AuxCartUpdated'); 107 } 108 }, 150); 109 110 111 } else { 112 $('.aux-hidden-blocks').append( response.data ); 113 } 114 115 } 116 117 }); 118 119 }); 120 }; 121 122 $(document).ready(function(){ 123 AuxinRemoveCartContent(); 124 AuxinAjaxAddToCart(); 125 }); 126 127 $.fn.AuxinCartAnimationHandler = function() { 128 $headerCartWrapper = $(this).find('.aux-cart-wrapper'); 129 $headerCartWrapper.trigger('AuxCartProgressAnimationDone'); 130 131 if ( ! $headerCartWrapper.hasClass('aux-basket-animation') ) { 132 return 133 } 134 135 $headerCartWrapper.on('AuxCartInProgress', function(e) { 136 $headerCartWrapper.addClass('aux-cart-in-progress'); 137 }); 138 139 $headerCartWrapper.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function(e) { 140 if ( e.originalEvent.animationName === 'FillBasket') { 141 $headerCartWrapper.removeClass('aux-cart-in-progress'); 142 $headerCartWrapper.trigger('AuxCartProgressAnimationDone'); 143 } 144 }); 145 146 $headerCartWrapper.on('AuxCartUpdated', function(e) { 147 $headerCartWrapper.addClass('aux-cart-updated-animation'); 148 }); 149 } 150 151 $('body').AuxinCartAnimationHandler(); 152 153 $(document.body).on( 'wc_cart_emptied', function(){ 154 $('.aux-shopping-basket .aux-cart-contents span').html('0'); 155 }); 156 157})(jQuery,window,document);
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.