PageSourceSearch

https://www.solution360.de/templates/easyTemplate360/js/jtl/form-counter.js?v=1.0.7

js solution360.de collected 2026-10-02 07:48:46 UTC 2,016 bytes, 61 lines download raw bytes

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

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.