PageSourceSearch

https://www.badger.ru/bitrix/templates/aspro_max/js/jquery.alphanumeric.js

js badger.ru collected 2026-09-24 09:44:49 UTC 1,972 bytes, 72 lines download raw bytes

1(function ($) {
2    $.fn.alphanumeric = function (p) {
3        var input = $(this),
4            az = "abcdefghijklmnopqrstuvwxyz",
5            options = $.extend({
6                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
7                nchars: '',
8                allow: ''
9            }, p),
10            s = options.allow.split(''),
11            i = 0,
12            ch,
13            regex;
14
15        for (i; i < s.length; i++) {
16            if (options.ichars.indexOf(s[i]) != -1) {
17                s[i] = '\\' + s[i];
18            }
19        }
20
21        if (options.nocaps) {
22            options.nchars += az.toUpperCase();
23        }
24        if (options.allcaps) {
25            options.nchars += az;
26        }
27
28        options.allow = s.join('|');
29
30        regex = new RegExp(options.allow, 'gi');
31        ch = (options.ichars + options.nchars).replace(regex, '');
32
33        input.keypress(function (e) {
34            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
35
36            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
37                e.preventDefault();
38            }
39        });
40
41        input.blur(function () {
42            var value = input.val(),
43                j = 0;
44
45            for (j; j < value.length; j++) {
46                if (ch.indexOf(value[j]) != -1) {
47                    input.val('');
48                    return false;
49                }
50            }
51            return false;
52        });
53
54        return input;
55    };
56
57    $.fn.numeric = function (p) {
58        var az = 'abcdefghijklmnopqrstuvwxyz',
59            aZ = az.toUpperCase();
60
61        return this.each(function () {
62            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
63        });
64    };
65
66    $.fn.alpha = function (p) {
67        var nm = '1234567890';
68        return this.each(function () {
69            $(this).alphanumeric($.extend({ nchars: nm }, p));
70        });
71    };
72})(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.