1// Ready function 2require(['jquery', 'slick'], function ($) { 3 $(document).ready(function (e) { 4 $(document).on('focusout', '.cart-item-qty', function () { 5 var parentElement = $(this).closest("div.product"); 6 parentElement.find('.spinner').show(); 7 parentElement.addClass('loading'); 8 var val = parentElement.find('.cart-item-qty').val(); 9 var oldValue = parseFloat(val); 10 parentElement.find(".update-cart-item").trigger('click'); 11 }); 12 $(document).on('click', '.minicart-wrapper .mini-cart .quantity-up', function() { 13 var parentElement = $(this).closest("div.product"); 14 parentElement.find('.spinner').show(); 15 parentElement.addClass('loading'); 16 var val = parentElement.find('.cart-item-qty').val(); 17 var oldValue = parseFloat(val); 18 var newVal = oldValue + 1; 19 parentElement.find('.cart-item-qty').val(newVal); 20 parentElement.find(".update-cart-item").trigger('click'); 21 }); 22 $(document).on('click', '.minicart-wrapper .mini-cart .quantity-down', function() { 23 var parentElement = $(this).closest("div.product"); 24 parentElement.find('.spinner').show(); 25 parentElement.addClass('loading'); 26 var val = parentElement.find('.cart-item-qty').val(); 27 var oldValue = parseFloat(val); 28 var newVal = oldValue - 1; 29 if(newVal < 0){ 30 newVal = 0; 31 } 32 parentElement.find('.cart-item-qty').val(newVal); 33 parentElement.find(".update-cart-item").trigger('click'); 34 }); 35 $(document).on('click', '.minicart-wrapper .addProduct-minicart:not(.disabled)', function(e) { 36 e.preventDefault(); 37 var formele = $(this).closest("form"); 38 var keyval = formele.find('input').val(); 39 if(!keyval){ 40 return false; 41 } 42 $(this).addClass('disabled'); 43 var formData = new FormData(); 44 formData.append( 'form_key', formele.find('input').val()); 45 $.ajax({ 46 url: formele.attr('action'), 47 data: formData, 48 type: 'post', 49 dataType: 'json', 50 cache: false, 51 contentType: false, 52 processData: false, 53 success: function (res) { 54 setTimeout(function(){ 55 if(!$('.minicart-wrapper').hasClass('active')){ 56 $('[data-block="minicart"]').find('[data-role="dropdownDialog"]').dropdownDialog("open"); 57 } 58 },3000); 59 60 $(this).removeClass('disabled'); 61 }, 62 63 /** @inheritdoc */ 64 error: function (res) { 65 $(this).removeClass('disabled'); 66 }, 67 68 /** @inheritdoc */ 69 complete: function (res) { 70 $(this).removeClass('disabled'); 71 } 72 }); 73 return false; 74 }); 75 76 $('[data-block="minicart"]').on('contentUpdated', function () { 77 $('.spinner').hide(); 78 $('.minicart-wrapper div.product').removeClass('loading'); 79 $("span").removeClass("minicart-price"); 80 if($('.dontForgetCard .product-items-minicart').length){ 81 setTimeout(function () { 82 $('.dontForgetCard .product-items-minicart').not('.slick-initialized').slick({ 83 "dots": true, 84 "arrows": false, 85 "infinite": true, 86 "autoplay": true, 87 "autoplaySpeed": 10000, 88 "speed": 300, 89 "slidesToShow": 1, 90 "slidesToScroll": 1, 91 "centerMode": false 92 }); 93 }, 500); 94 setTimeout(function () { $('.dontForgetCard .product-items-minicart.slick-initialized').slick('refresh'); }, 600); 95 } 96 }); 97 $(document).on('click', '.minicart-wrapper .estimateShippingInfo', function() { 98 $(this).toggleClass("active"); 99 }); 100 }) 101})
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.