1// jQuery mask_2 Plugin v1.13.4 2// github.com/igorescobar/jQuery-mask_2-Plugin 3(function(b) { 4 "function" === typeof define && define.amd ? define(["jquery"], b) : "object" === typeof exports ? module.exports = b(require("jquery")) : b(jQuery || Zepto) 5})(function(b) { 6 var y = function(a, c, d) { 7 a = b(a); 8 var g = this, 9 k = a.val(), 10 l; 11 c = "function" === typeof c ? c(a.val(), void 0, a, d) : c; 12 var e = { 13 invalid: [], 14 getCaret: function() { 15 try { 16 var q, b = 0, 17 e = a.get(0), 18 f = document.selection, 19 c = e.selectionStart; 20 if (f && -1 === navigator.appVersion.indexOf("MSIE 10")) q = f.createRange(), q.moveStart("character", a.is("input") ? -a.val().length : -a.text().length), 21 b = q.text.length; 22 else if (c || "0" === c) b = c; 23 return b 24 } catch (d) {} 25 }, 26 setCaret: function(q) { 27 try { 28 if (a.is(":focus")) { 29 var b, c = a.get(0); 30 c.setSelectionRange ? c.setSelectionRange(q, q) : c.createTextRange && (b = c.createTextRange(), b.collapse(!0), b.moveEnd("character", q), b.moveStart("character", q), b.select()) 31 } 32 } catch (f) {} 33 }, 34 events: function() { 35 a.on("input.mask_2 keyup.mask_2", e.behaviour).on("paste.mask_2 drop.mask_2", function() { 36 setTimeout(function() { 37 a.keydown().keyup() 38 }, 100) 39 }).on("change.mask_2", function() { 40 a.data("changed", !0) 41 }).on("blur.mask_2", 42 function() { 43 k === a.val() || a.data("changed") || a.triggerHandler("change"); 44 a.data("changed", !1) 45 }).on("blur.mask_2", function() { 46 k = a.val() 47 }).on("focus.mask_2", function(a) { 48 !0 === d.selectOnFocus && b(a.target).select() 49 }).on("focusout.mask_2", function() { 50 d.clearIfNotMatch && !l.test(e.val()) && e.val("") 51 }) 52 }, 53 getRegexmask_2: function() { 54 for (var a = [], b, e, f, d, h = 0; h < c.length; h++)(b = g.translation[c.charAt(h)]) ? (e = b.pattern.toString().replace(/.{1}$|^.{1}/g, ""), f = b.optional, (b = b.recursive) ? (a.push(c.charAt(h)), d = { 55 digit: c.charAt(h), 56 pattern: e 57 }) : a.push(f || b ? e + "?" : e)) : a.push(c.charAt(h).replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")); 58 a = a.join(""); 59 d && (a = a.replace(new RegExp("(" + d.digit + "(.*" + d.digit + ")?)"), "($1)?").replace(new RegExp(d.digit, "g"), d.pattern)); 60 return new RegExp(a) 61 }, 62 destroyEvents: function() { 63 a.off("input keydown keyup paste drop blur focusout ".split(" ").join(".mask_2 ")) 64 }, 65 val: function(b) { 66 var c = a.is("input") ? "val" : "text"; 67 if (0 < arguments.length) { 68 if (a[c]() !== b) a[c](b); 69 c = a 70 } else c = a[c](); 71 return c 72 }, 73 getMCharsBeforeCount: function(a, 74 b) { 75 for (var e = 0, f = 0, d = c.length; f < d && f < a; f++) g.translation[c.charAt(f)] || (a = b ? a + 1 : a, e++); 76 return e 77 }, 78 caretPos: function(a, b, d, f) { 79 return g.translation[c.charAt(Math.min(a - 1, c.length - 1))] ? Math.min(a + d - b - f, d) : e.caretPos(a + 1, b, d, f) 80 }, 81 behaviour: function(a) { 82 a = a || window.event;
83 e.invalid = []; 84 var c = a.keyCode || a.which; 85 if (-1 === b.inArray(c, g.byPassKeys)) { 86 var d = e.getCaret(), 87 f = e.val().length, 88 n = d < f, 89 h = e.getmask_2ed(), 90 k = h.length, 91 m = e.getMCharsBeforeCount(k - 1) - e.getMCharsBeforeCount(f - 1); 92 e.val(h); 93 !n || 65 === c && a.ctrlKey || (8 !== 94 c && 46 !== c && (d = e.caretPos(d, f, k, m)), e.setCaret(d)); 95 return e.callbacks(a) 96 } 97 }, 98 getmask_2ed: function(a) { 99 var b = [], 100 k = e.val(), 101 f = 0, 102 n = c.length, 103 h = 0, 104 l = k.length, 105 m = 1, 106 p = "push", 107 u = -1, 108 t, w; 109 d.reverse ? (p = "unshift", m = -1, t = 0, f = n - 1, h = l - 1, w = function() { 110 return -1 < f && -1 < h 111 }
vendor: 5,666 bytes, lines 111-255
111) : (t = n - 1, w = function() { 112 return f < n && h < l 113 }); 114 for (; w();) { 115 var x = c.charAt(f), 116 v = k.charAt(h), 117 r = g.translation[x]; 118 if (r) v.match(r.pattern) ? (b[p](v), r.recursive && (-1 === u ? u = f : f === t && (f = u - m), t === u && (f -= m)), f += m) : r.optional ? (f += m, h -= m) : r.fallback ? (b[p](r.fallback), f += m, h -= m) : e.invalid.push({ 119 p: h, 120 v: v, 121 e: r.pattern 122 }), h += m; 123 else { 124 if (!a) b[p](x); 125 v === x && (h += m); 126 f += m 127 } 128 } 129 a = c.charAt(t); 130 n !== l + 1 || g.translation[a] || b.push(a); 131 return b.join("") 132 }, 133 callbacks: function(b) { 134 var g = e.val(), 135 l = g !== k, 136 f = [g, b, a, d], 137 n = function(a, b, c) { 138 "function" === typeof d[a] && b && d[a].apply(this, c) 139 }; 140 n("onChange", !0 === l, f); 141 n("onKeyPress", !0 === l, f); 142 n("onComplete", g.length === c.length, f); 143 n("onInvalid", 0 < e.invalid.length, [g, b, a, e.invalid, d]) 144 } 145 }; 146 g.mask_2 = c; 147 g.options = d; 148 g.remove = function() { 149 var b = e.getCaret(); 150 e.destroyEvents(); 151 e.val(g.getCleanVal()); 152 e.setCaret(b - 153 e.getMCharsBeforeCount(b)); 154 return a 155 }; 156 g.getCleanVal = function() { 157 return e.getmask_2ed(!0) 158 }; 159 g.init = function(c) { 160 c = c || !1; 161 d = d || {}; 162 g.byPassKeys = b.jmask_2Globals.byPassKeys; 163 g.translation = b.jmask_2Globals.translation; 164 g.translation = b.extend({}, g.translation, d.translation); 165 g = b.extend(!0, {}, g, d); 166 l = e.getRegexmask_2(); 167 !1 === c ? (d.placeholder && a.attr("placeholder", d.placeholder), b("input").length && !1 === "oninput" in b("input")[0] && "on" === a.attr("autocomplete") && a.attr("autocomplete", "off"), e.destroyEvents(), e.events(), c = e.getCaret(), 168 e.val(e.getmask_2ed()), e.setCaret(c + e.getMCharsBeforeCount(c, !0))) : (e.events(), e.val(e.getmask_2ed())) 169 }; 170 g.init(!a.is("input")) 171 }; 172 b.mask_2Watchers = {}; 173 var A = function() { 174 var a = b(this), 175 c = {}, 176 d = a.attr("data-mask_2"); 177 a.attr("data-mask_2-reverse") && (c.reverse = !0); 178 a.attr("data-mask_2-clearifnotmatch") && (c.clearIfNotMatch = !0); 179 "true" === a.attr("data-mask_2-selectonfocus") && (c.selectOnFocus = !0); 180 if (z(a, d, c)) return a.data("mask_2", new y(this, d, c)) 181 }, 182 z = function(a, c, d) { 183 d = d || {}; 184 var g = b(a).data("mask_2"), 185 k = JSON.stringify; 186 a = b(a).val() || 187 b(a).text(); 188 try { 189 return "function" === typeof c && (c = c(a)), "object" !== typeof g || k(g.options) !== k(d) || g.mask_2 !== c 190 } catch (l) {} 191 }; 192 b.fn.mask_2 = function(a, c) { 193 c = c || {}; 194 var d = this.selector, 195 g = b.jmask_2Globals, 196 k = b.jmask_2Globals.watchInterval, 197 l = function() { 198 if (z(this, a, c)) return b(this).data("mask_2", new y(this, a, c)) 199 }; 200 b(this).each(l); 201 d && "" !== d && g.watchInputs && (clearInterval(b.mask_2Watchers[d]), b.mask_2Watchers[d] = setInterval(function() { 202 b(document).find(d).each(l) 203 }, k)); 204 return this 205 }; 206 b.fn.unmask_2 = function() { 207 clearInterval(b.mask_2Watchers[this.selector]); 208 delete b.mask_2Watchers[this.selector]; 209 return this.each(function() { 210 var a = b(this).data("mask_2"); 211 a && a.remove().removeData("mask_2") 212 }) 213 }; 214 b.fn.cleanVal = function() { 215 return this.data("mask_2").getCleanVal() 216 }; 217 b.applyDatamask_2 = function(a) { 218 a = a || b.jmask_2Globals.mask_2Elements; 219 (a instanceof b ? a : b(a)).filter(b.jmask_2Globals.datamask_2Attr).each(A) 220 }; 221 var p = { 222 mask_2Elements: "input,td,span,div", 223 datamask_2Attr: "*[data-mask_2]", 224 datamask_2: !0, 225 watchInterval: 300, 226 watchInputs: !0, 227 watchDatamask_2: !1, 228 byPassKeys: [9, 16, 17, 18, 36, 37, 38, 39, 40, 91], 229 translation: { 230 0: { 231 pattern: /\d/ 232 }, 233 9: { 234 pattern: /\d/, 235 optional: !0 236 }, 237 "#": { 238 pattern: /\d/, 239 recursive: !0 240 }, 241 A: { 242 pattern: /[a-zA-Z0-9]/ 243 }, 244 S: { 245 pattern: /[a-zA-Z]/ 246 } 247 } 248 }; 249 b.jmask_2Globals = b.jmask_2Globals || {}; 250 p = b.jmask_2Globals = b.extend(!0, {}, p, b.jmask_2Globals); 251 p.datamask_2 && b.applyDatamask_2(); 252 setInterval(function() { 253 b.jmask_2Globals.watchDatamask_2 && b.applyDatamask_2() 254 }, p.watchInterval) 255});
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.