1 2const Classes = { 3 counter : 'form-counter' 4}; 5 6const Data = { 7 up : 'data-count-up', 8 down : 'data-count-down' 9}; 10 11 12const proxy = function(fn, ...args) { 13 return function() { 14 fn.call(this, ...args) 15 } 16}; 17 18const updateCount = function(increase = false) { 19 let $input = $(this).parents(`.${Classes.counter}`).find('.form-control'); 20 let input = $input.get(0); 21 let control = $(this).closest('.custom-control').find('input.custom-control-input').get(0) 22 let stepDirection = increase ? 'stepUp' : 'stepDown'; 23 24 try { 25 input[stepDirection](); 26 if (control != null && control.disabled == false) { 27 control.checked = true 28 } 29 $input.trigger('change') 30 } catch(e) { 31 let step = input.step > 0 ? parseFloat(input.step) : 1; 32 33 let newValue = increase ? parseFloat(input.value) + step : parseFloat(input.value) - step; 34 35 if(newValue > parseFloat(input.max)) return; 36 if(newValue < parseFloat(input.min)) return; 37 38 input.value = (newValue).toFixed($input.data('decimals')); 39 } 40}; 41 42window.initNumberInput = function () { 43 $(`[${Data.up}]`).off('click.numberInputUp').on('click.numberInputUp', proxy(updateCount, true)); 44 $(`[${Data.down}]`).off('click.numberInputDown').on('click.numberInputDown', proxy(updateCount)); 45 $(`.${Classes.counter} .form-control`).off('blur.numberInput').on('blur.numberInput', function() { 46 let min = parseInt(this.min); 47 let max = parseInt(this.max); 48 let value = parseInt(this.value); 49 let control = $(this).closest('.custom-control').find('input.custom-control-input').get(0) 50 51 if (control != null && control.disabled == false) { 52 control.checked = true 53 } 54 if(value < min) this.value = min; 55 if(value > max) this.value = max; 56 }) 57};
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.