1window.addEventListener("DOMContentLoaded", (event) => 2{ 3 function set_listener_for_qty() 4 { 5 const inputs_qty = document.querySelectorAll(`[id^="quantity_"]`); 6 7 for (const input of inputs_qty) 8 { 9 const step = input.getAttribute("step"); 10 11 if( step != 1 ) 12 { 13 input.addEventListener('keyup', (e) => 14 { 15 if( ! Number.isInteger(e.target.valueAsNumber / step) ) 16 { 17 setTimeout( () => { 18 e.target.value = Math.ceil(e.target.valueAsNumber / step) * step; 19 },300 ) 20 } 21 }); 22 } 23 } 24 } 25 set_listener_for_qty(); 26 27 jQuery( document.body ).on('updated_cart_totals', function( event ) { 28 set_listener_for_qty(); 29 }); 30 31});
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.