mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-06-14 20:16:05 +00:00
Initial commit
This commit is contained in:
1062
app/static/global/plugins/jquery-inputmask/README.md
Normal file
1062
app/static/global/plugins/jquery-inputmask/README.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,442 @@
|
||||
/*!
|
||||
* jquery.inputmask.date.extensions.js
|
||||
* http://github.com/RobinHerbots/jquery.inputmask
|
||||
* Copyright (c) 2010 - 2014 Robin Herbots
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
* Version: 3.1.34
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
|
||||
}(function($) {
|
||||
return $.extend($.inputmask.defaults.definitions, {
|
||||
h: {
|
||||
validator: "[01][0-9]|2[0-3]",
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: "[0-2]",
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
s: {
|
||||
validator: "[0-5][0-9]",
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: "[0-5]",
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
d: {
|
||||
validator: "0[1-9]|[12][0-9]|3[01]",
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: "[0-3]",
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
m: {
|
||||
validator: "0[1-9]|1[012]",
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: "[01]",
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
y: {
|
||||
validator: "(19|20)\\d{2}",
|
||||
cardinality: 4,
|
||||
prevalidator: [ {
|
||||
validator: "[12]",
|
||||
cardinality: 1
|
||||
}, {
|
||||
validator: "(19|20)",
|
||||
cardinality: 2
|
||||
}, {
|
||||
validator: "(19|20)\\d",
|
||||
cardinality: 3
|
||||
} ]
|
||||
}
|
||||
}), $.extend($.inputmask.defaults.aliases, {
|
||||
"dd/mm/yyyy": {
|
||||
mask: "1/2/y",
|
||||
placeholder: "dd/mm/yyyy",
|
||||
regex: {
|
||||
val1pre: new RegExp("[0-3]"),
|
||||
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
|
||||
val2pre: function(separator) {
|
||||
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
||||
return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
|
||||
},
|
||||
val2: function(separator) {
|
||||
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
||||
return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
|
||||
}
|
||||
},
|
||||
leapday: "29/02/",
|
||||
separator: "/",
|
||||
yearrange: {
|
||||
minyear: 1900,
|
||||
maxyear: 2099
|
||||
},
|
||||
isInYearRange: function(chrs, minyear, maxyear) {
|
||||
if (isNaN(chrs)) return !1;
|
||||
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
|
||||
return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
|
||||
},
|
||||
determinebaseyear: function(minyear, maxyear, hint) {
|
||||
var currentyear = new Date().getFullYear();
|
||||
if (minyear > currentyear) return minyear;
|
||||
if (currentyear > maxyear) {
|
||||
for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
|
||||
var maxxYear = maxYearPrefix + maxYearPostfix;
|
||||
return minyear > maxxYear ? minyear : maxxYear;
|
||||
}
|
||||
return currentyear;
|
||||
},
|
||||
onKeyUp: function(e) {
|
||||
var $input = $(this);
|
||||
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
||||
var today = new Date();
|
||||
$input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());
|
||||
}
|
||||
},
|
||||
definitions: {
|
||||
"1": {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.regex.val1.test(chrs);
|
||||
return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
||||
{
|
||||
refreshFromBuffer: {
|
||||
start: pos - 1,
|
||||
end: pos
|
||||
},
|
||||
pos: pos,
|
||||
c: chrs.charAt(0)
|
||||
});
|
||||
},
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
||||
var isValid = 1 == chrs.length ? opts.regex.val1pre.test(chrs) : opts.regex.val1.test(chrs);
|
||||
return strict || isValid || !(isValid = opts.regex.val1.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
||||
pos++, {
|
||||
pos: pos
|
||||
});
|
||||
},
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
"2": {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
||||
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
||||
var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
|
||||
if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
||||
{
|
||||
refreshFromBuffer: {
|
||||
start: pos - 1,
|
||||
end: pos
|
||||
},
|
||||
pos: pos,
|
||||
c: chrs.charAt(0)
|
||||
};
|
||||
if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
|
||||
var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
|
||||
if (dayMonthValue != opts.leapday) return !0;
|
||||
var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
|
||||
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
||||
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
||||
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
||||
var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
|
||||
return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
||||
pos++, {
|
||||
pos: pos
|
||||
});
|
||||
},
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
y: {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
||||
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
||||
if (dayMonthValue != opts.leapday) return !0;
|
||||
var year = parseInt(chrs, 10);
|
||||
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
||||
}
|
||||
return !1;
|
||||
},
|
||||
cardinality: 4,
|
||||
prevalidator: [ {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
||||
if (!strict && !isValid) {
|
||||
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
|
||||
if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
||||
{
|
||||
pos: pos
|
||||
};
|
||||
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
|
||||
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
||||
maskset.buffer[pos++] = yearPrefix.charAt(1), {
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 1
|
||||
}, {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
||||
if (!strict && !isValid) {
|
||||
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
|
||||
if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
|
||||
{
|
||||
pos: pos
|
||||
};
|
||||
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
|
||||
opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
||||
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
||||
if (dayMonthValue != opts.leapday) isValid = !0; else {
|
||||
var year = parseInt(chrs, 10);
|
||||
isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
||||
}
|
||||
} else isValid = !1;
|
||||
if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1),
|
||||
maskset.buffer[pos++] = chrs.charAt(0), {
|
||||
refreshFromBuffer: {
|
||||
start: pos - 3,
|
||||
end: pos
|
||||
},
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 2
|
||||
}, {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
||||
},
|
||||
cardinality: 3
|
||||
} ]
|
||||
}
|
||||
},
|
||||
insertMode: !1,
|
||||
autoUnmask: !1
|
||||
},
|
||||
"mm/dd/yyyy": {
|
||||
placeholder: "mm/dd/yyyy",
|
||||
alias: "dd/mm/yyyy",
|
||||
regex: {
|
||||
val2pre: function(separator) {
|
||||
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
||||
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
||||
},
|
||||
val2: function(separator) {
|
||||
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
||||
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
||||
},
|
||||
val1pre: new RegExp("[01]"),
|
||||
val1: new RegExp("0[1-9]|1[012]")
|
||||
},
|
||||
leapday: "02/29/",
|
||||
onKeyUp: function(e) {
|
||||
var $input = $(this);
|
||||
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
||||
var today = new Date();
|
||||
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
"yyyy/mm/dd": {
|
||||
mask: "y/1/2",
|
||||
placeholder: "yyyy/mm/dd",
|
||||
alias: "mm/dd/yyyy",
|
||||
leapday: "/02/29",
|
||||
onKeyUp: function(e) {
|
||||
var $input = $(this);
|
||||
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
||||
var today = new Date();
|
||||
$input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
"dd.mm.yyyy": {
|
||||
mask: "1.2.y",
|
||||
placeholder: "dd.mm.yyyy",
|
||||
leapday: "29.02.",
|
||||
separator: ".",
|
||||
alias: "dd/mm/yyyy"
|
||||
},
|
||||
"dd-mm-yyyy": {
|
||||
mask: "1-2-y",
|
||||
placeholder: "dd-mm-yyyy",
|
||||
leapday: "29-02-",
|
||||
separator: "-",
|
||||
alias: "dd/mm/yyyy"
|
||||
},
|
||||
"mm.dd.yyyy": {
|
||||
mask: "1.2.y",
|
||||
placeholder: "mm.dd.yyyy",
|
||||
leapday: "02.29.",
|
||||
separator: ".",
|
||||
alias: "mm/dd/yyyy"
|
||||
},
|
||||
"mm-dd-yyyy": {
|
||||
mask: "1-2-y",
|
||||
placeholder: "mm-dd-yyyy",
|
||||
leapday: "02-29-",
|
||||
separator: "-",
|
||||
alias: "mm/dd/yyyy"
|
||||
},
|
||||
"yyyy.mm.dd": {
|
||||
mask: "y.1.2",
|
||||
placeholder: "yyyy.mm.dd",
|
||||
leapday: ".02.29",
|
||||
separator: ".",
|
||||
alias: "yyyy/mm/dd"
|
||||
},
|
||||
"yyyy-mm-dd": {
|
||||
mask: "y-1-2",
|
||||
placeholder: "yyyy-mm-dd",
|
||||
leapday: "-02-29",
|
||||
separator: "-",
|
||||
alias: "yyyy/mm/dd"
|
||||
},
|
||||
datetime: {
|
||||
mask: "1/2/y h:s",
|
||||
placeholder: "dd/mm/yyyy hh:mm",
|
||||
alias: "dd/mm/yyyy",
|
||||
regex: {
|
||||
hrspre: new RegExp("[012]"),
|
||||
hrs24: new RegExp("2[0-4]|1[3-9]"),
|
||||
hrs: new RegExp("[01][0-9]|2[0-4]"),
|
||||
ampm: new RegExp("^[a|p|A|P][m|M]"),
|
||||
mspre: new RegExp("[0-5]"),
|
||||
ms: new RegExp("[0-5][0-9]")
|
||||
},
|
||||
timeseparator: ":",
|
||||
hourFormat: "24",
|
||||
definitions: {
|
||||
h: {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
|
||||
maskset.buffer[pos] = "0", {
|
||||
refreshFromBuffer: {
|
||||
start: pos - 1,
|
||||
end: pos
|
||||
},
|
||||
c: "0"
|
||||
};
|
||||
var isValid = opts.regex.hrs.test(chrs);
|
||||
if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
||||
maskset.buffer[pos] = chrs.charAt(0), pos++, {
|
||||
refreshFromBuffer: {
|
||||
start: pos - 2,
|
||||
end: pos
|
||||
},
|
||||
pos: pos,
|
||||
c: opts.timeseparator
|
||||
};
|
||||
if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
|
||||
var tmp = parseInt(chrs, 10);
|
||||
return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
|
||||
maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
|
||||
maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
|
||||
maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
|
||||
refreshFromBuffer: {
|
||||
start: pos - 1,
|
||||
end: pos + 6
|
||||
},
|
||||
c: maskset.buffer[pos]
|
||||
};
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.regex.hrspre.test(chrs);
|
||||
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
||||
pos++, {
|
||||
pos: pos
|
||||
});
|
||||
},
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
s: {
|
||||
validator: "[0-5][0-9]",
|
||||
cardinality: 2,
|
||||
prevalidator: [ {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.regex.mspre.test(chrs);
|
||||
return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
||||
pos++, {
|
||||
pos: pos
|
||||
});
|
||||
},
|
||||
cardinality: 1
|
||||
} ]
|
||||
},
|
||||
t: {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
return opts.regex.ampm.test(chrs + "m");
|
||||
},
|
||||
casing: "lower",
|
||||
cardinality: 1
|
||||
}
|
||||
},
|
||||
insertMode: !1,
|
||||
autoUnmask: !1
|
||||
},
|
||||
datetime12: {
|
||||
mask: "1/2/y h:s t\\m",
|
||||
placeholder: "dd/mm/yyyy hh:mm xm",
|
||||
alias: "datetime",
|
||||
hourFormat: "12"
|
||||
},
|
||||
"hh:mm t": {
|
||||
mask: "h:s t\\m",
|
||||
placeholder: "hh:mm xm",
|
||||
alias: "datetime",
|
||||
hourFormat: "12"
|
||||
},
|
||||
"h:s t": {
|
||||
mask: "h:s t\\m",
|
||||
placeholder: "hh:mm xm",
|
||||
alias: "datetime",
|
||||
hourFormat: "12"
|
||||
},
|
||||
"hh:mm:ss": {
|
||||
mask: "h:s:s",
|
||||
placeholder: "hh:mm:ss",
|
||||
alias: "datetime",
|
||||
autoUnmask: !1
|
||||
},
|
||||
"hh:mm": {
|
||||
mask: "h:s",
|
||||
placeholder: "hh:mm",
|
||||
alias: "datetime",
|
||||
autoUnmask: !1
|
||||
},
|
||||
date: {
|
||||
alias: "dd/mm/yyyy"
|
||||
},
|
||||
"mm/yyyy": {
|
||||
mask: "1/y",
|
||||
placeholder: "mm/yyyy",
|
||||
leapday: "donotuse",
|
||||
separator: "/",
|
||||
alias: "mm/dd/yyyy"
|
||||
}
|
||||
}), $.fn.inputmask;
|
||||
});
|
@ -0,0 +1,107 @@
|
||||
/*!
|
||||
* jquery.inputmask.extensions.js
|
||||
* http://github.com/RobinHerbots/jquery.inputmask
|
||||
* Copyright (c) 2010 - 2014 Robin Herbots
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
* Version: 3.1.34
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
|
||||
}(function($) {
|
||||
return $.extend($.inputmask.defaults.definitions, {
|
||||
A: {
|
||||
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
||||
cardinality: 1,
|
||||
casing: "upper"
|
||||
},
|
||||
"#": {
|
||||
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
||||
cardinality: 1,
|
||||
casing: "upper"
|
||||
}
|
||||
}), $.extend($.inputmask.defaults.aliases, {
|
||||
url: {
|
||||
mask: "ir",
|
||||
placeholder: "",
|
||||
separator: "",
|
||||
defaultPrefix: "http://",
|
||||
regex: {
|
||||
urlpre1: new RegExp("[fh]"),
|
||||
urlpre2: new RegExp("(ft|ht)"),
|
||||
urlpre3: new RegExp("(ftp|htt)"),
|
||||
urlpre4: new RegExp("(ftp:|http|ftps)"),
|
||||
urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
|
||||
urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
|
||||
urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
|
||||
urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
|
||||
},
|
||||
definitions: {
|
||||
i: {
|
||||
validator: function() {
|
||||
return !0;
|
||||
},
|
||||
cardinality: 8,
|
||||
prevalidator: function() {
|
||||
for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
|
||||
var j = i;
|
||||
return {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
if (opts.regex["urlpre" + (j + 1)]) {
|
||||
var k, tmp = chrs;
|
||||
j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
|
||||
var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
|
||||
if (!strict && !isValid) {
|
||||
for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
|
||||
pos++;
|
||||
for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
|
||||
return {
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
return !1;
|
||||
},
|
||||
cardinality: j
|
||||
};
|
||||
}();
|
||||
return result;
|
||||
}()
|
||||
},
|
||||
r: {
|
||||
validator: ".",
|
||||
cardinality: 50
|
||||
}
|
||||
},
|
||||
insertMode: !1,
|
||||
autoUnmask: !1
|
||||
},
|
||||
ip: {
|
||||
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
||||
definitions: {
|
||||
i: {
|
||||
validator: function(chrs, maskset, pos) {
|
||||
return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
||||
chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
||||
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
||||
},
|
||||
cardinality: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
email: {
|
||||
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
|
||||
greedy: !1,
|
||||
onBeforePaste: function(pastedValue) {
|
||||
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
||||
},
|
||||
definitions: {
|
||||
"*": {
|
||||
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
|
||||
cardinality: 1,
|
||||
casing: "lower"
|
||||
}
|
||||
}
|
||||
}
|
||||
}), $.fn.inputmask;
|
||||
});
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,255 @@
|
||||
/*!
|
||||
* jquery.inputmask.numeric.extensions.js
|
||||
* http://github.com/RobinHerbots/jquery.inputmask
|
||||
* Copyright (c) 2010 - 2014 Robin Herbots
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
* Version: 3.1.34
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
|
||||
}(function($) {
|
||||
return $.extend($.inputmask.defaults.aliases, {
|
||||
numeric: {
|
||||
mask: function(opts) {
|
||||
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
||||
opts.repeat = 0, opts.groupSeparator == opts.radixPoint && (opts.groupSeparator = "." == opts.radixPoint ? "," : "," == opts.radixPoint ? "." : ""),
|
||||
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" != opts.groupSeparator,
|
||||
opts.autoGroup && isFinite(opts.integerDigits)) {
|
||||
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
||||
opts.integerDigits += 0 == mod ? seps - 1 : seps;
|
||||
}
|
||||
opts.definitions[";"] = opts.definitions["~"];
|
||||
var mask = opts.prefix;
|
||||
return mask += "[+]", mask += "~{1," + opts.integerDigits + "}", void 0 != opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
|
||||
mask += opts.suffix;
|
||||
},
|
||||
placeholder: "",
|
||||
greedy: !1,
|
||||
digits: "*",
|
||||
digitsOptional: !0,
|
||||
groupSeparator: "",
|
||||
radixPoint: ".",
|
||||
radixFocus: !0,
|
||||
groupSize: 3,
|
||||
autoGroup: !1,
|
||||
allowPlus: !0,
|
||||
allowMinus: !0,
|
||||
integerDigits: "+",
|
||||
prefix: "",
|
||||
suffix: "",
|
||||
rightAlign: !0,
|
||||
decimalProtect: !0,
|
||||
postFormat: function(buffer, pos, reformatOnly, opts) {
|
||||
var needsRefresh = !1, charAtPos = buffer[pos];
|
||||
if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[-+]").test(charAtPos)) return {
|
||||
pos: pos
|
||||
};
|
||||
var cbuf = buffer.slice();
|
||||
charAtPos == opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
|
||||
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
|
||||
var bufVal = cbuf.join("");
|
||||
if (bufVal.length > 0 && opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
|
||||
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
|
||||
needsRefresh = 0 == bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
||||
var radixSplit = bufVal.split(opts.radixPoint);
|
||||
if (bufVal = "" == opts.radixPoint ? bufVal : radixSplit[0], bufVal != opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) {
|
||||
needsRefresh = !0;
|
||||
for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
||||
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
|
||||
}
|
||||
"" != opts.radixPoint && radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
|
||||
}
|
||||
buffer.length = bufVal.length;
|
||||
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
||||
var newPos = $.inArray("?", buffer);
|
||||
return reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), {
|
||||
pos: newPos,
|
||||
refreshFromBuffer: needsRefresh
|
||||
};
|
||||
},
|
||||
onKeyDown: function(e, buffer, caretPos, opts) {
|
||||
if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
|
||||
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
||||
if (-1 != radixPosition && isFinite(opts.digits)) {
|
||||
for (var i = 1; i <= opts.digits; i++) (void 0 == buffer[radixPosition + i] || buffer[radixPosition + i] == opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
|
||||
return {
|
||||
refreshFromBuffer: {
|
||||
start: ++radixPosition,
|
||||
end: radixPosition + opts.digits
|
||||
}
|
||||
};
|
||||
}
|
||||
} else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
|
||||
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
||||
return rslt.caret = rslt.pos + 1, rslt;
|
||||
}
|
||||
},
|
||||
onKeyPress: function(e, buffer, caretPos, opts) {
|
||||
if (opts.autoGroup) {
|
||||
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
||||
return rslt.caret = rslt.pos + 1, rslt;
|
||||
}
|
||||
},
|
||||
postProcessOnBlur: function(tmpBuffer, opts) {
|
||||
var tmpBufSplit = "" != opts.radixPoint ? tmpBuffer.join("").split(opts.radixPoint) : [ tmpBuffer.join("") ], matchRslt = tmpBufSplit[0].match(opts.regex.integerPart(opts)), matchRsltDigits = 2 == tmpBufSplit.length ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : void 0;
|
||||
matchRslt && "-0" == matchRslt[matchRslt.index] && (void 0 == matchRsltDigits || matchRsltDigits[matchRsltDigits.index].match(/^0+$/)) && tmpBuffer.splice(0, 1);
|
||||
},
|
||||
regex: {
|
||||
integerPart: function() {
|
||||
return new RegExp("[-+]?\\d+");
|
||||
},
|
||||
integerNPart: function() {
|
||||
return new RegExp("\\d+");
|
||||
}
|
||||
},
|
||||
signHandler: function(chrs, maskset, pos, strict, opts) {
|
||||
if (!strict && (opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs)) {
|
||||
var matchRslt = maskset.buffer.join("").match(opts.regex.integerPart(opts));
|
||||
if (matchRslt && matchRslt[matchRslt.index].length > 0 && ("0" !== matchRslt[matchRslt.index] || maskset.buffer && maskset._buffer && maskset.buffer.join("") != maskset._buffer.join(""))) return maskset.buffer[matchRslt.index] == ("-" === chrs ? "+" : "-") ? {
|
||||
pos: matchRslt.index,
|
||||
c: chrs,
|
||||
remove: matchRslt.index,
|
||||
caret: pos
|
||||
} : maskset.buffer[matchRslt.index] == ("-" === chrs ? "-" : "+") ? {
|
||||
remove: matchRslt.index,
|
||||
caret: pos - 1
|
||||
} : {
|
||||
pos: matchRslt.index,
|
||||
c: chrs,
|
||||
caret: pos + 1
|
||||
};
|
||||
}
|
||||
return !1;
|
||||
},
|
||||
radixHandler: function(chrs, maskset, pos, strict, opts) {
|
||||
if (!strict && chrs === opts.radixPoint && opts.digits > 0) {
|
||||
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
|
||||
if (-1 != radixPos && maskset.validPositions[radixPos]) return maskset.validPositions[radixPos - 1] ? {
|
||||
caret: radixPos + 1
|
||||
} : {
|
||||
pos: integerValue.index,
|
||||
c: integerValue[0],
|
||||
caret: radixPos + 1
|
||||
};
|
||||
if (!integerValue || "0" == integerValue[0]) return maskset.buffer[integerValue ? integerValue.index : pos] = "0",
|
||||
{
|
||||
pos: (integerValue ? integerValue.index : pos) + 1
|
||||
};
|
||||
}
|
||||
return !1;
|
||||
},
|
||||
leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
|
||||
var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
||||
if (matchRslt && !strict && (-1 == radixPosition || matchRslt.index < radixPosition)) if ("0" == matchRslt[0] && pos >= opts.prefix.length) {
|
||||
if (-1 == radixPosition || radixPosition >= pos && void 0 == maskset.validPositions[radixPosition]) return maskset.buffer.splice(matchRslt.index, 1),
|
||||
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
||||
pos: pos,
|
||||
remove: matchRslt.index
|
||||
};
|
||||
if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1),
|
||||
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
||||
pos: pos,
|
||||
remove: matchRslt.index
|
||||
};
|
||||
if (void 0 == maskset.validPositions[radixPosition]) return maskset.buffer[pos] = chrs,
|
||||
{
|
||||
refreshFromBuffer: !0
|
||||
};
|
||||
} else if ("0" == chrs && pos <= matchRslt.index) return !1;
|
||||
return !0;
|
||||
},
|
||||
definitions: {
|
||||
"~": {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
|
||||
if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
|
||||
!isValid && (isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
|
||||
isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
|
||||
isValid === !0)))) {
|
||||
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
||||
isValid = opts.digitsOptional === !1 && pos > radixPosition && !strict ? {
|
||||
pos: pos,
|
||||
remove: pos
|
||||
} : {
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 1,
|
||||
prevalidator: null
|
||||
},
|
||||
"+": {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
|
||||
return isValid || (isValid = opts.allowMinus && "-" == chrs || opts.allowPlus && "+" == chrs),
|
||||
isValid;
|
||||
},
|
||||
cardinality: 1,
|
||||
prevalidator: null,
|
||||
placeholder: ""
|
||||
},
|
||||
":": {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
|
||||
if (!isValid) {
|
||||
var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
|
||||
isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder == opts.radixPoint && (isValid = {
|
||||
pos: pos,
|
||||
remove: pos
|
||||
});
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 1,
|
||||
prevalidator: null,
|
||||
placeholder: function(opts) {
|
||||
return opts.radixPoint;
|
||||
}
|
||||
}
|
||||
},
|
||||
insertMode: !0,
|
||||
autoUnmask: !1,
|
||||
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
||||
var processValue = maskedValue.replace(opts.prefix, "");
|
||||
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
||||
},
|
||||
isComplete: function(buffer, opts) {
|
||||
var maskedValue = buffer.join(""), bufClone = buffer.slice();
|
||||
if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") != maskedValue) return !1;
|
||||
var processValue = maskedValue.replace(opts.prefix, "");
|
||||
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
||||
processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
||||
isFinite(processValue);
|
||||
},
|
||||
onBeforeMask: function(initialValue, opts) {
|
||||
if ("" != opts.radixPoint && isFinite(initialValue)) initialValue = initialValue.toString().replace(".", opts.radixPoint); else {
|
||||
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
||||
dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
||||
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
|
||||
initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
||||
}
|
||||
return 0 == opts.digits && (-1 != initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 != initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
||||
initialValue;
|
||||
}
|
||||
},
|
||||
currency: {
|
||||
prefix: "$ ",
|
||||
groupSeparator: ",",
|
||||
alias: "numeric",
|
||||
placeholder: "0",
|
||||
autoGroup: !0,
|
||||
digits: 2,
|
||||
digitsOptional: !1,
|
||||
clearMaskOnLostFocus: !1
|
||||
},
|
||||
decimal: {
|
||||
alias: "numeric"
|
||||
},
|
||||
integer: {
|
||||
alias: "numeric",
|
||||
digits: "0",
|
||||
radixPoint: ""
|
||||
}
|
||||
}), $.fn.inputmask;
|
||||
});
|
@ -0,0 +1,60 @@
|
||||
/*!
|
||||
* jquery.inputmask.phone.extensions.js
|
||||
* http://github.com/RobinHerbots/jquery.inputmask
|
||||
* Copyright (c) 2010 - 2014 Robin Herbots
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
* Version: 3.1.34
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
|
||||
}(function($) {
|
||||
return $.extend($.inputmask.defaults.aliases, {
|
||||
phone: {
|
||||
url: "phone-codes/phone-codes.js",
|
||||
maskInit: "+pp(pp)pppppppp",
|
||||
countrycode: "",
|
||||
mask: function(opts) {
|
||||
opts.definitions = {
|
||||
p: {
|
||||
validator: function() {
|
||||
return !1;
|
||||
},
|
||||
cardinality: 1
|
||||
},
|
||||
"#": {
|
||||
validator: "[0-9]",
|
||||
cardinality: 1
|
||||
}
|
||||
};
|
||||
var maskList = [];
|
||||
return $.ajax({
|
||||
url: opts.url,
|
||||
async: !1,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
maskList = response;
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + " - " + opts.url);
|
||||
}
|
||||
}), maskList = maskList.sort(function(a, b) {
|
||||
return (a.mask || a) < (b.mask || b) ? -1 : 1;
|
||||
}), "" != opts.countrycode && (opts.maskInit = "+" + opts.countrycode + opts.maskInit.substring(3)),
|
||||
maskList.splice(0, 0, opts.maskInit), maskList;
|
||||
},
|
||||
nojumps: !0,
|
||||
nojumpsThreshold: 1,
|
||||
onBeforeMask: function(value, opts) {
|
||||
var processedValue = value.replace(/^0/g, "");
|
||||
return (processedValue.indexOf(opts.countrycode) > 1 || -1 == processedValue.indexOf(opts.countrycode)) && (processedValue = opts.countrycode + processedValue),
|
||||
processedValue;
|
||||
}
|
||||
},
|
||||
phonebe: {
|
||||
alias: "phone",
|
||||
url: "phone-codes/phone-be.js",
|
||||
countrycode: "32",
|
||||
nojumpsThreshold: 4
|
||||
}
|
||||
}), $.fn.inputmask;
|
||||
});
|
@ -0,0 +1,124 @@
|
||||
/*!
|
||||
* jquery.inputmask.regex.extensions.js
|
||||
* http://github.com/RobinHerbots/jquery.inputmask
|
||||
* Copyright (c) 2010 - 2014 Robin Herbots
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
* Version: 3.1.34
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
|
||||
}(function($) {
|
||||
return $.extend($.inputmask.defaults.aliases, {
|
||||
Regex: {
|
||||
mask: "r",
|
||||
greedy: !1,
|
||||
repeat: "*",
|
||||
regex: null,
|
||||
regexTokens: null,
|
||||
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
|
||||
quantifierFilter: /[0-9]+[^,]/,
|
||||
isComplete: function(buffer, opts) {
|
||||
return new RegExp(opts.regex).test(buffer.join(""));
|
||||
},
|
||||
definitions: {
|
||||
r: {
|
||||
validator: function(chrs, maskset, pos, strict, opts) {
|
||||
function regexToken(isGroup, isQuantifier) {
|
||||
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
||||
this.quantifier = {
|
||||
min: 1,
|
||||
max: 1
|
||||
}, this.repeaterPart = void 0;
|
||||
}
|
||||
function analyseRegex() {
|
||||
var match, m, currentToken = new regexToken(), opengroups = [];
|
||||
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
||||
m.charAt(0)) {
|
||||
case "(":
|
||||
opengroups.push(new regexToken(!0));
|
||||
break;
|
||||
|
||||
case ")":
|
||||
var groupToken = opengroups.pop();
|
||||
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
||||
break;
|
||||
|
||||
case "{":
|
||||
case "+":
|
||||
case "*":
|
||||
var quantifierToken = new regexToken(!1, !0);
|
||||
m = m.replace(/[{}]/g, "");
|
||||
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
||||
if (quantifierToken.quantifier = {
|
||||
min: mq0,
|
||||
max: mq1
|
||||
}, opengroups.length > 0) {
|
||||
var matches = opengroups[opengroups.length - 1].matches;
|
||||
if (match = matches.pop(), !match.isGroup) {
|
||||
var groupToken = new regexToken(!0);
|
||||
groupToken.matches.push(match), match = groupToken;
|
||||
}
|
||||
matches.push(match), matches.push(quantifierToken);
|
||||
} else {
|
||||
if (match = currentToken.matches.pop(), !match.isGroup) {
|
||||
var groupToken = new regexToken(!0);
|
||||
groupToken.matches.push(match), match = groupToken;
|
||||
}
|
||||
currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
||||
}
|
||||
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
||||
}
|
||||
function validateRegexToken(token, fromGroup) {
|
||||
var isvalid = !1;
|
||||
fromGroup && (regexPart += "(", openGroupCount++);
|
||||
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
||||
var matchToken = token.matches[mndx];
|
||||
if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
|
||||
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
||||
if (isNaN(matchToken.quantifier.max)) {
|
||||
for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
||||
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
||||
regexPart = regexPartBak + matchToken.quantifier.max;
|
||||
} else {
|
||||
for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
||||
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
||||
}
|
||||
} else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
||||
var testExp;
|
||||
if ("[" == matchToken.charAt(0)) {
|
||||
testExp = regexPart, testExp += matchToken;
|
||||
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
||||
var exp = new RegExp("^(" + testExp + ")$");
|
||||
isvalid = exp.test(bufferStr);
|
||||
} else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
|
||||
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
||||
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
||||
var exp = new RegExp("^(" + testExp + ")$");
|
||||
if (isvalid = exp.test(bufferStr)) break;
|
||||
}
|
||||
regexPart += matchToken;
|
||||
}
|
||||
if (isvalid) break;
|
||||
}
|
||||
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
||||
}
|
||||
null == opts.regexTokens && analyseRegex();
|
||||
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
||||
cbuffer.splice(pos, 0, chrs);
|
||||
for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
|
||||
var regexToken = opts.regexTokens[i];
|
||||
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
cardinality: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}), $.fn.inputmask;
|
||||
});
|
File diff suppressed because it is too large
Load Diff
10
app/static/global/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js
vendored
Normal file
10
app/static/global/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user