PageSourceSearch

https://nawatis.ru/bitrix/templates/fortis_s1/assets/js/vendor/inputmask/jquery.inputmask.extensions.js

js nawatis.ru collected 2026-10-04 20:44:51 UTC 5,316 bytes, 122 lines download raw bytes

1/*
2Input Mask plugin extensions
3http://github.com/RobinHerbots/jquery.inputmask
4Copyright (c) 2010 - 2014 Robin Herbots
5Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6Version: 0.0.0
7
8Optional extensions on the jquery.inputmask base
9*/
10(function ($) {
11    //extra definitions
12    $.extend($.inputmask.defaults.definitions, {
13        'A': {
14            validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
15            cardinality: 1,
16            casing: "upper" //auto uppercasing
17        },
18        '#': {
19            validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
20            cardinality: 1,
21            casing: "upper"
22        }
23    });
24    $.extend($.inputmask.defaults.aliases, {
25        'url': {
26            mask: "ir",
27            placeholder: "",
28            separator: "",
29            defaultPrefix: "http://",
30            regex: {
31                urlpre1: new RegExp("[fh]"),
32                urlpre2: new RegExp("(ft|ht)"),
33                urlpre3: new RegExp("(ftp|htt)"),
34                urlpre4: new RegExp("(ftp:|http|ftps)"),
35                urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
36                urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
37                urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
38                urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
39            },
40            definitions: {
41                'i': {
42                    validator: function (chrs, maskset, pos, strict, opts) {
43                        return true;
44                    },
45                    cardinality: 8,
46                    prevalidator: (function () {
47                        var result = [], prefixLimit = 8;
48                        for (var i = 0; i < prefixLimit; i++) {
49                            result[i] = (function () {
50                                var j = i;
51                                return {
52                                    validator: function (chrs, maskset, pos, strict, opts) {
53                                        if (opts.regex["urlpre" + (j + 1)]) {
54                                            var tmp = chrs, k;
55                                            if (((j + 1) - chrs.length) > 0) {
56                                                tmp = maskset.buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
57                                            }
58                                            var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
59                                            if (!strict && !isValid) {
60                                                pos = pos - j;
61                                                for (k = 0; k < opts.defaultPrefix.length; k++) {
62                                                    maskset.buffer[pos] = opts.defaultPrefix[k]; pos++;
63                                                }
64                                                for (k = 0; k < tmp.length - 1; k++) {
65                                                    maskset.buffer[pos] = tmp[k]; pos++;
66                                                }
67                                                return { "pos": pos };
68                                            }
69                                            return isValid;
70                                        } else {
71                                            return false;
72                                        }
73                                    }, cardinality: j
74                                };
75                            })();
76                        }
77                        return result;
78                    })()
79                },
80                "r": {
81                    validator: ".",
82                    cardinality: 50
83                }
84            },
85            insertMode: false,
86            autoUnmask: false
87        },
88        "ip": { //ip-address mask
89            mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
90            definitions: {
91                'i': {
92                    validator: function (chrs, maskset, pos, strict, opts) {
93                        if (pos - 1 > -1 && maskset.buffer[pos - 1] != ".") {
94                            chrs = maskset.buffer[pos - 1] + chrs;
95                            if (pos - 2 > -1 && maskset.buffer[pos - 2] != ".") {
96                                chrs = maskset.buffer[pos - 2] + chrs;
97                            } else chrs = "0" + chrs;
98                        } else chrs = "00" + chrs;
99                        return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
100                    },
101                    cardinality: 1
102                }
103            }
104        },
105        "email": {
106            mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
107            greedy: false,
108            onBeforePaste: function (pastedValue, opts) {
109                pastedValue = pastedValue.toLowerCase();
110                return pastedValue.replace("mailto:", "");
111            },
112            definitions: {
113                '*': {
114                    validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
115                    cardinality: 1,
116                    casing: "lower"
117                }
118            }
119        }
120    });
121    return $.fn.inputmask;
122})(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.