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]", 15 cardinality: 1, 16 casing: "upper" //auto uppercasing 17 }, 18 '#': { 19 validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]", 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, buffer, 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, buffer, pos, strict, opts) { 53 if (opts.regex["urlpre" + (j + 1)]) { 54 var tmp = chrs, k; 55 if (((j + 1) - chrs.length) > 0) { 56 tmp = 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 buffer[pos] = opts.defaultPrefix[k]; pos++; 63 } 64 for (k = 0; k < tmp.length - 1; k++) { 65 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: ["[[x]y]z.[[x]y]z.[[x]y]z.x[yz]", "[[x]y]z.[[x]y]z.[[x]y]z.[[x]y][z]"], 90 definitions: { 91 'x': { 92 validator: "[012]", 93 cardinality: 1, 94 definitionSymbol: "i" 95 }, 96 'y': { 97 validator: function (chrs, buffer, pos, strict, opts) { 98 if (pos - 1 > -1 && buffer[pos - 1] != ".") 99 chrs = buffer[pos - 1] + chrs; 100 else chrs = "0" + chrs; 101 return new RegExp("2[0-5]|[01][0-9]").test(chrs); 102 }, 103 cardinality: 1, 104 definitionSymbol: "i" 105 }, 106 'z': { 107 validator: function (chrs, buffer, pos, strict, opts) { 108 if (pos - 1 > -1 && buffer[pos - 1] != ".") { 109 chrs = buffer[pos - 1] + chrs; 110 if (pos - 2 > -1 && buffer[pos - 2] != ".") { 111 chrs = buffer[pos - 2] + chrs; 112 } else chrs = "0" + chrs; 113 } else chrs = "00" + chrs; 114 return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs); 115 }, 116 cardinality: 1, 117 definitionSymbol: "i" 118 } 119 } 120 } 121 }); 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.