PageSourceSearch

https://www.life-run.co.il/includes/customInputControls/jquery.lim…9lc3OPy-ODh09-DV-62dbLiEQm7L9uMhETOJ5QjTeQ1

js life-run.co.il collected 2026-09-29 16:25:20 UTC 3,041 bytes, 82 lines download raw bytes

1(function ($) {
2    $.fn.limitTextbox = function (options) {
3
4        // build main options
5        var opts = $.extend({}, $.fn.limitTextbox.defaults, options);
6
7        if (options != undefined && options.regex != undefined)
8            $(this).data("limit-textbox", options.regex);
9
10        // iterate each element
11        return this.each(function () {
12            var $this = $(this);
13
14            $this.unbind("focus", $.fn.limitTextbox.regexFocus)
15                .unbind("keypress", $.fn.limitTextbox.regexKeypress)
16                .unbind("keyup", $.fn.limitTextbox.regexKeyup)
17                .focus($.fn.limitTextbox.regexFocus)
18                .keypress($.fn.limitTextbox.regexKeypress)
19                .keyup($.fn.limitTextbox.regexKeyup);
20        });
21    };
22
23    $.fn.limitTextbox.regexFocus = function () {
24        this.currentValue = $(this).val();
25    };
26
27    $.fn.limitTextbox.regexKeyup = function (e) {
28        inputCheck(e, this, "Keyup");
29    }
30
31    $.fn.limitTextbox.regexKeypress = function (e) {
32        inputCheck(e, this, "Keypress");
33    }
34
35    function inputCheck(e, sender, eventType) {
36        var $sender = $(sender);
37        var keyCode = getKeyCode(e);
38
39        if ($.inArray(keyCode, [46/*backspace*/, 8/*delete*/, 9/*tab*/, 27/*escape*/, 13/*enter*/, 17/*ctrl*/]) !== -1 || // Allow: backspace, delete, tab, escape, enter, ctrl
40            (e.ctrlKey && keyCode != 86/*v*/ && keyCode != 90/*z*/) || //Allow all Ctrl combinations except: Ctrl+V, Ctrl+Z
41            (e.ctrlKey && keyCode == 86 && eventType != "Keyup") || //Allow Ctrl+V except in Keyup
42            //(e.ctrlKey && keyCode == 88) || // Allow: Ctrl+A
43            (keyCode >= 35 && keyCode <= 39)) {// Allow: home, end, left, right
44            return true;
45        }
46
47        var regexPattern = $sender.data("limit-textbox");
48        if (regexPattern == null || regexPattern == "")
49            return true;
50
51        var value = sender.value + ((e.ctrlKey || eventType == "Keyup") ? "" : String.fromCharCode(keyCode).toLocaleLowerCase());
52        var regex = new RegExp(regexPattern);
53
54        if (!regex.test(value)) {
55            if (eventType == "Keyup")
56                sender.value = sender.currentValue;
57            e.preventDefault();
58            return false;
59        }
60        else {
61            sender.currentValue = sender.value;
62        }
63    };
64
65    function getKeyCode(e) {
66        var keyCode = (window.event ? event.keyCode : e.keyCode);
67        if (keyCode == 0 && e.which != null)
68            keyCode = e.which;
69        if (keyCode == 0 && e.charCode != null)
70            keyCode = e.charCode;
71
72        return keyCode;
73    }
74
75    /********************************************************************************/
76    /* defaults                                                                     */
77    /********************************************************************************/
78
79    $.fn.limitTextbox.defaults = {
80    };
81
82})(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.