1(function ($) { 2 3 'use strict'; 4 5 // Update WooCommerce mini cart. 6 7 // Trigger event 8 $( document.body ).on( 'adding_to_cart', function() { 9 $('.g1-drop-toggle-badge').removeClass('g1-drop-toggle-badge-animate'); 10 } ); 11 12 $( document.body ).on( 'added_to_cart removed_from_cart', function() { 13 // the event is called BEFORE the cart AJAX comes back so we need a small timeout or we'll get the wrong count. 14 setTimeout(function() { 15 var $drop = $('.g1-drop-the-cart'); 16 17 var count = parseInt( $drop.find( '.cart_list').data('g1-cart-count'), 10 ); 18 if ( count > 0 ) { 19 $drop.find('.g1-drop-toggle-badge').removeClass('g1-drop-toggle-badge-hidden').addClass('g1-drop-toggle-badge-animate').text(count); 20 } else { 21 $drop.find('.g1-drop-toggle-badge').addClass('g1-drop-toggle-badge-hidden').text(count); 22 } 23 }, 500); 24 } ); 25 26 // Add our custom class to the link "View Cart" after product was added to the cart. 27 // The "View Cart" link is located on product list, under the "Add to Cart" button. 28 $(document.body).on('wc_cart_button_updated', function (e, $button) { 29 $button.next('a.added_to_cart').addClass('g1-link g1-link-right'); 30 }); 31 32})(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.