1(function ($) { 2 $.fn.alphanumeric = function (p) { 3 var input = $(this), 4 az = "abcdefghijklmnopqrstuvwxyzÄ Å¼ÅźÄÅóÄ", 5 options = $.extend({ 6 ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _', 7 nchars: '', 8 allow: '', 9 limit: 0, 10 counter: '' // todo 11 }, p), 12 s = options.allow.split(''), 13 i = 0, 14 ch, 15 regex; 16 17 for (i; i < s.length; i++) { 18 if (options.ichars.indexOf(s[i]) != -1) { 19 s[i] = '\\' + s[i]; 20 } 21 } 22 23 if (options.nocaps) { 24 options.nchars += az.toUpperCase(); 25 } 26 if (options.allcaps) { 27 options.nchars += az; 28 } 29 if (options.limit && options.limit > 0) { 30 31 var interval, f; 32 var self = input; 33 34 $(this).focus(function(){ 35 interval = window.setInterval(substring,100); 36 }); 37 38 $(this).bind("keyup keypress blur change", function(){ 39 clearInterval(interval); 40 substring(); 41 }); 42 43 substringFunction = "function substring(){ var val = $(self).val();var length = val.length;if(length > options.limit){$(self).val($(self).val().substring(0,options.limit));}"; 44 if(typeof $(options.counter) != 'undefined') 45 { 46 47 substringFunction += "if($(options.counter).html() != options.limit - length){$(options.counter).html((options.limit - length<=0)?'0':options.limit - length);}"; 48 49 } 50 substringFunction += "}"; 51 52 eval(substringFunction); 53 substring(); 54 55 } 56 57 options.allow = s.join('|'); 58 59 regex = new RegExp(options.allow, 'gi'); 60 ch = (options.ichars + options.nchars).replace(regex, ''); 61 62 input.keypress(function (e) { 63 var key = String.fromCharCode(!e.charCode ? e.which : e.charCode); 64 65 if (ch.indexOf(key) != -1 && !e.ctrlKey) { 66 e.preventDefault(); 67 } 68 }); 69 70 input.blur(function () { 71 var value = input.val(), 72 j = 0; 73 74 for (j; j < value.length; j++) { 75 if (ch.indexOf(value[j]) != -1) { 76 input.val(''); 77 return false; 78 } 79 } 80 return false; 81 }); 82 83 return input; 84 }; 85 86 $.fn.numeric = function (p) { 87 var az = 'abcdefghijklmnopqrstuvwxyzÄ Å¼ÅźÄÅóÄ', 88 aZ = az.toUpperCase(); 89 90 return this.each(function () { 91 $(this).alphanumeric($.extend({ nchars: az + aZ }, p)); 92 }); 93 }; 94 95 $.fn.alpha = function (p) { 96 var nm = '1234567890'; 97 return this.each(function () { 98 $(this).alphanumeric($.extend({ nchars: nm }, p)); 99 }); 100 }; 101 102 103 104})(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.