1//declare timer for basket form submit 2var timer = null; 3 4//see if auto update is enabled 5var autoUpdateEnabled = false; 6if ($("#quantity-auto-update")) 7{ 8 autoUpdateEnabled = $("#quantity-auto-update").data("status"); 9} 10 11// decrease quantity value in option list row 12$(function () { 13 $("body").on("click", "#basketContent button#row-qty-minus", function () { 14 15 var parentRow = $(this).closest("div"); 16 var minusLink = $(parentRow).find("button#row-qty-minus").val() 17 18 var quantityField = $(parentRow).find("input#modal-qty"); 19 var quantity = quantityField.val(); 20 21 if (parseInt(quantity) > 1) { 22 quantityField.val(parseInt(quantity) - 1) 23 24 //set timer for basket form submit 25 if (autoUpdateEnabled && timer == null) { 26 timer = setTimeout(submitCart, 2000); 27 } 28 } 29 }) 30}); 31 32// increase quantity value in option list row 33$(function () { 34 $("body").on("click", "#basketContent button#row-qty-plus", function () { 35 36 var parentRow = $(this).closest("div"); 37 var minusLink = $(parentRow).find("button#row-qty-plus").val() 38 39 var quantityField = $(parentRow).find("input#modal-qty"); 40 var quantity = quantityField.val(); 41 quantityField.val(parseInt(quantity) + 1) 42 43 //set timer for basket form submit 44 if (autoUpdateEnabled && timer == null) { 45 timer = setTimeout(submitCart, 2000); 46 } 47 }) 48}); 49 50function onBasketUpdate(response) { 51 52 // item updated/removed from cart 53 // update the basket and wishlist count in header 54 if (typeof storeheadernavigation !== 'undefined') { 55 storeheadernavigation.refresh(); 56 } 57 if (typeof storemenu !== 'undefined') { 58 storemenu.refresh(true); 59 } 60 61 //enable plus/minus buttons and reset the timer. 62 if (autoUpdateEnabled) { 63 $("#basketContent button#row-qty-plus, #basketContent button#row-qty-minus").attr("disabled", false); 64 timer = null; 65 } 66 67 68} 69 70if (autoUpdateEnabled) { 71 72 function submitCart() { 73 74 //disable plus/minus buttons 75 $("#basketContent button#row-qty-plus, #basketContent button#row-qty-minus").attr("disabled", true); 76 77 //submit basket form 78 $('#IsCheckoutButton').val(0); 79 $("#basket-form").submit(); 80 } 81 82 // submit basket form on loose focus 83 $('#basketContent input#modal-qty').blur(submitCart); 84 85 // pervent submit on enter key 86 $(document).on('keyup keypress', function (e) { 87 var keyCode = e.keyCode || e.which; 88 if (keyCode === 13 && e.target.id === "modal-qty") { 89 e.preventDefault(); 90 submitCart(); 91 return false; 92 } 93 }); 94}
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.