PageSourceSearch

https://enjoyfurs.ru/assets/compo/js/widgets/inputNumber.js

js enjoyfurs.ru collected 2026-10-04 23:32:01 UTC 2,886 bytes, 81 lines download raw bytes

1(function ($) {
2    $.widget("compo.inputNumber", {
3
4        _create: function () {
5            var self = this;
6
7            //plugin bootstrap minus and plus
8            //http://jsfiddle.net/laelitenetwork/puJ6G/
9
10            self.element.parent().find('.btn-number').click(function(e){
11                e.preventDefault();
12
13                fieldName = $(this).attr('data-field');
14                type      = $(this).attr('data-type');
15                var input = $("input[name='"+fieldName+"']");
16                var currentVal = parseInt(input.val());
17
18                if (!isNaN(currentVal)) {
19                    if(type == 'minus') {
20
21                        if(currentVal > input.attr('min')) {
22                            input.val(currentVal - 1).change();
23                        }
24
25                        if(parseInt(input.val()) == input.attr('min')) {
26                            $(this).attr('disabled', true);
27                        }
28
29                    } else if(type == 'plus') {
30                        input.val(currentVal + 1).change();
31
32
33                    }
34                } else {
35                    input.val(0);
36                }
37            });
38
39            self.element.focusin(function(){
40                $(this).data('oldValue', $(this).val());
41            });
42
43            self.element.change(function() {
44
45                minValue =  parseInt($(this).attr('min'));
46                maxValue =  parseInt($(this).attr('max'));
47                valueCurrent = parseInt($(this).val());
48
49                name = $(this).attr('name');
50                if(valueCurrent >= minValue) {
51                    $(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
52                } else {
53                    $(this).val($(this).data('oldValue'));
54                }
55
56                if(valueCurrent <= maxValue) {
57                    $(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
58                } else {
59                    $(this).val($(this).data('oldValue'));
60                }
61            });
62
63            self.element.keydown(function (e) {
64                // Allow: backspace, delete, tab, escape, enter and .
65                if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
66                        // Allow: Ctrl+A
67                    (e.keyCode == 65 && e.ctrlKey === true) ||
68                        // Allow: home, end, left, right
69                    (e.keyCode >= 35 && e.keyCode <= 39)) {
70                    // let it happen, don't do anything
71                    return;
72                }
73                // Ensure that it is a number and stop the keypress
74                if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
75                    e.preventDefault();
76                }
77            });
78        }
79
80    });
81})(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.