1(function ($) { 2 "use strict"; 3 4 $(document).on('bacolaShopPageInit', function () { 5 bacolaThemeModule.addtocartquantity(); 6 }); 7 8 bacolaThemeModule.addtocartquantity = function() { 9 var container = $( '.cart-with-quantity' ); 10 container.each( function() { 11 var self = $(this); 12 var button = self.find( '.ajax_add_to_cart' ); 13 var quantity = self.find( '.ajax-quantity' ); 14 15 button.on( 'click', function(e) { 16 17 var min = quantity.find( '.input-text.qty' ).attr('min'); 18 if(min > 1){ 19 quantity.find( '.input-text.qty' ).val(min); 20 } else { 21 quantity.find( '.input-text.qty' ).val(1); 22 } 23 24 button.closest('.cart-with-quantity').find('.quantity-button.plus').append('<svg class="loader-image preloader added" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg"><circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg>'); 25 e.preventDefault(); 26 $(this).hide(); 27 addQty(); 28 }); 29 30 $( document.body ).on( 'added_to_cart', function() { 31 $('svg.preloader.added').remove(); 32 }); 33 34 function addQty() { 35 quantity.css( 'display', 'flex' ); 36 37 } 38 39 }); 40 } 41 42 $(document).ready(function() { 43 44 $(document).on('click', '.quantity-button', function(event){ 45 46 var quantity = $(this).closest('.ajax-quantity'); 47 var button = $(this).closest('.cart-with-quantity').find( '.ajax_add_to_cart' ); 48 49 50 var qty_input = quantity.find( '.input-text.qty' ); 51 if ( $(qty_input).prop('disabled') ) return; 52 var qty_step = parseFloat($(qty_input).attr('step')); 53 var qty_min = parseFloat($(qty_input).attr('min')); 54 var qty_max = parseFloat($(qty_input).attr('max')); 55 56 57 if ( $(this).hasClass('minus') ){ 58 var vl = parseFloat($(qty_input).val()); 59 vl = ( (vl - qty_step) < qty_min ) ? qty_min : (vl - qty_step); 60 $(qty_input).val(vl); 61 62 $(this).closest('.product-button-group').find('a.button').attr('data-quantity', vl); 63 64 } else if ( $(this).hasClass('plus') ) { 65 var vl = parseFloat($(qty_input).val()); 66 vl = ( (vl + qty_step) > qty_max ) ? qty_max : (vl + qty_step); 67 $(qty_input).val(vl); 68 $(this).closest('.product-button-group').find('a.button').attr('data-quantity', vl); 69 70 } 71 72 function showButton() { 73 button.css( 'display', 'flex' ); 74 quantity.hide(); 75 quantity.find( '.input-text.qty' ).val(0); 76 } 77 78 if ( qty_input.val() === '0' ) { 79 showButton(); 80 $(this).closest('.product-button-group').find('a.button').attr('data-quantity', '1'); 81 } 82 83 qty_input.trigger( 'change' ); 84 }); 85 86 bacolaThemeModule.addtocartquantity(); 87 }); 88 89})(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.