1(function ($) { 2 Journal['stepperDecimals'] = +Journal['stepperDecimals'] || 0; 3 4 function stepper(el) { 5 const $this = $(el); 6 7 const $input = $this.find('input[name^="quantity"]'); 8 const minimum = parseFloat($input.data('minimum')) || 1; 9 10 function change(value, delta) { 11 value = value || 0; 12 delta = delta || 0; 13 14 if (!Journal['stepperDecimals']) { 15 delta = 1; 16 } 17 18 const val = Math.max((+$input.val() || 0) + value * delta, minimum); 19 20 $input.val(val.toFixed(Journal['stepperDecimals'])); 21 22 $input.trigger('change'); 23 } 24 25 $this.find('.fa-angle-up').on('click', function (e) { 26 change(1, e.shiftKey ? 0.1 : 1); 27 }); 28 29 $this.find('.fa-angle-down').on('click', function (e) { 30 change(-1, e.shiftKey ? 0.1 : 1); 31 }); 32 33 $input.on('keydown', function (e) { 34 switch (e.key) { 35 case 'ArrowUp': 36 e.preventDefault(); 37 38 change(1, e.shiftKey ? 0.1 : 1); 39 break; 40 41 case 'ArrowDown': 42 e.preventDefault(); 43 44 change(-1, e.shiftKey ? 0.1 : 1); 45 break; 46 } 47 }); 48 49 $input.on('blur', function () { 50 change(); 51 }); 52 } 53 54 if (Journal['stepperStatus']) { 55 Journal.lazy('stepper', '.stepper', { 56 load: function (el) { 57 stepper(el); 58 } 59 }); 60 } 61})(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.