Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery.inputmask

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery.inputmask - npm Package Compare versions

Comparing version 3.1.26 to 3.1.27

dist/jquery.inputmask.bundle.min.js

2

bower.json
{
"name": "jquery.inputmask",
"version": "3.1.26",
"version": "3.1.27",
"main": [

@@ -5,0 +5,0 @@ "./dist/inputmask/jquery.inputmask.js",

@@ -6,82 +6,92 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.26
* Version: 3.1.27
*/
(function (factory) {if (typeof define === 'function' && define.amd) {define(["jquery","./jquery.inputmask"], factory);} else {factory(jQuery);}}/*
Input Mask plugin extensions
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: 0.0.0
Optional extensions on the jquery.inputmask base
*/
(function ($) {
//date & time aliases
$.extend($.inputmask.defaults.definitions, {
'h': { //hours
!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 }]
prevalidator: [ {
validator: "[0-2]",
cardinality: 1
} ]
},
's': { //seconds || minutes
s: {
validator: "[0-5][0-9]",
cardinality: 2,
prevalidator: [{ validator: "[0-5]", cardinality: 1 }]
prevalidator: [ {
validator: "[0-5]",
cardinality: 1
} ]
},
'd': { //basic day
d: {
validator: "0[1-9]|[12][0-9]|3[01]",
cardinality: 2,
prevalidator: [{ validator: "[0-3]", cardinality: 1 }]
prevalidator: [ {
validator: "[0-3]",
cardinality: 1
} ]
},
'm': { //basic month
m: {
validator: "0[1-9]|1[012]",
cardinality: 2,
prevalidator: [{ validator: "[01]", cardinality: 1 }]
prevalidator: [ {
validator: "[01]",
cardinality: 1
} ]
},
'y': { //basic year
y: {
validator: "(19|20)\\d{2}",
cardinality: 4,
prevalidator: [
{ validator: "[12]", cardinality: 1 },
{ validator: "(19|20)", cardinality: 2 },
{ validator: "(19|20)\\d", cardinality: 3 }
]
prevalidator: [ {
validator: "[12]",
cardinality: 1
}, {
validator: "(19|20)",
cardinality: 2
}, {
validator: "(19|20)\\d",
cardinality: 3
} ]
}
});
$.extend($.inputmask.defaults.aliases, {
'dd/mm/yyyy': {
}), $.extend($.inputmask.defaults.aliases, {
"dd/mm/yyyy": {
mask: "1/2/y",
placeholder: "dd/mm/yyyy",
regex: {
val1pre: new RegExp("[0-3]"), //daypre
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), //day
val2pre: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])"); }, //monthpre
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]))"); }//month
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 false;
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length)));
var enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
return (!isNaN(enteredyear) ? minyear <= enteredyear && enteredyear <= maxyear : false) ||
(!isNaN(enteredyear2) ? minyear <= enteredyear2 && enteredyear2 <= maxyear : false);
separator: "/",
yearrange: {
minyear: 1900,
maxyear: 2099
},
determinebaseyear: function (minyear, maxyear, hint) {
var currentyear = (new Date()).getFullYear();
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 (maxyear < currentyear) {
var maxYearPrefix = maxyear.toString().slice(0, 2);
var maxYearPostfix = maxyear.toString().slice(2, 4);
while (maxyear < maxYearPrefix + hint) {
maxYearPrefix--;
}
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, buffer, caretPos, opts) {
onKeyUp: function(e) {
var $input = $(this);

@@ -94,190 +104,151 @@ if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {

definitions: {
'1': { //val1 ~ day or month
validator: function (chrs, maskset, pos, strict, opts) {
"1": {
validator: function(chrs, maskset, pos, strict, opts) {
var isValid = opts.regex.val1.test(chrs);
if (!strict && !isValid) {
if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) {
isValid = opts.regex.val1.test("0" + chrs.charAt(0));
if (isValid) {
maskset.buffer[pos - 1] = "0";
return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
}
}
}
return isValid;
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) {
if (!isNaN(maskset.buffer[pos + 1])) chrs += maskset.buffer[pos + 1];
var isValid = chrs.length == 1 ? opts.regex.val1pre.test(chrs) : opts.regex.val1.test(chrs);
if (!strict && !isValid) {
isValid = opts.regex.val1.test("0" + chrs);
if (isValid) {
maskset.buffer[pos] = "0";
pos++;
return { "pos": pos };
}
}
return isValid;
}, cardinality: 1
}]
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': { //val2 ~ day or month
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);
if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator;
"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) {
if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) {
isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
if (isValid) {
maskset.buffer[pos - 1] = "0";
return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
}
}
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;
}
//check leap yeap
if ((opts.mask.indexOf("2") == opts.mask.length - 1) && isValid) {
var dayMonthValue = maskset.buffer.join('').substr(4, 4) + chrs;
if (dayMonthValue != opts.leapday)
return true;
else {
var year = parseInt(maskset.buffer.join('').substr(0, 4), 10); //detect leap year
if (year % 4 === 0)
if (year % 100 === 0)
if (year % 400 === 0)
return true;
else return false;
else return true;
else return false;
}
}
return isValid;
},
cardinality: 2,
prevalidator: [{
validator: function (chrs, maskset, pos, strict, opts) {
if (!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);
if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator;
var isValid = chrs.length == 1 ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
if (!strict && !isValid) {
isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs);
if (isValid) {
maskset.buffer[pos] = "0";
pos++;
return { "pos": pos };
}
}
return isValid;
}, cardinality: 1
}]
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': { //year
validator: function (chrs, maskset, pos, strict, opts) {
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 true;
else {
var year = parseInt(chrs, 10);//detect leap year
if (year % 4 === 0)
if (year % 100 === 0)
if (year % 400 === 0)
return true;
else return false;
else return true;
else return false;
}
} else return false;
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);
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
if (isValid) {
maskset.buffer[pos++] = yearPrefix.charAt(0);
return { "pos": pos };
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
};
}
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);
if (isValid) {
maskset.buffer[pos++] = yearPrefix.charAt(0);
maskset.buffer[pos++] = yearPrefix.charAt(1);
return { "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: 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);
isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear);
if (isValid) {
maskset.buffer[pos++] = yearPrefix.charAt(1);
return { "pos": pos };
}
yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
if (opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
var dayMonthValue = maskset.buffer.join('').substr(0, 6);
if (dayMonthValue != opts.leapday)
isValid = true;
else {
var year = parseInt(chrs, 10);//detect leap year
if (year % 4 === 0)
if (year % 100 === 0)
if (year % 400 === 0)
isValid = true;
else isValid = false;
else isValid = true;
else isValid = false;
}
} else isValid = false;
if (isValid) {
maskset.buffer[pos - 1] = yearPrefix.charAt(0);
maskset.buffer[pos++] = yearPrefix.charAt(1);
maskset.buffer[pos++] = chrs.charAt(0);
return { "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
return isValid;
},
cardinality: 2
}, {
validator: function(chrs, maskset, pos, strict, opts) {
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
},
cardinality: 3
} ]
}
]
}
},
insertMode: false,
autoUnmask: false
insertMode: !1,
autoUnmask: !1
},
'mm/dd/yyyy': {
"mm/dd/yyyy": {
placeholder: "mm/dd/yyyy",
alias: "dd/mm/yyyy", //reuse functionality of dd/mm/yyyy alias
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])"); }, //daypre
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)"); }, //day
val1pre: new RegExp("[01]"), //monthpre
val1: new RegExp("0[1-9]|1[012]") //month
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, buffer, caretPos, opts) {
onKeyUp: function(e) {
var $input = $(this);

@@ -290,3 +261,3 @@ if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {

},
'yyyy/mm/dd': {
"yyyy/mm/dd": {
mask: "y/1/2",

@@ -296,3 +267,3 @@ placeholder: "yyyy/mm/dd",

leapday: "/02/29",
onKeyUp: function (e, buffer, caretPos, opts) {
onKeyUp: function(e) {
var $input = $(this);

@@ -305,45 +276,45 @@ if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {

},
'dd.mm.yyyy': {
"dd.mm.yyyy": {
mask: "1.2.y",
placeholder: "dd.mm.yyyy",
leapday: "29.02.",
separator: '.',
separator: ".",
alias: "dd/mm/yyyy"
},
'dd-mm-yyyy': {
"dd-mm-yyyy": {
mask: "1-2-y",
placeholder: "dd-mm-yyyy",
leapday: "29-02-",
separator: '-',
separator: "-",
alias: "dd/mm/yyyy"
},
'mm.dd.yyyy': {
"mm.dd.yyyy": {
mask: "1.2.y",
placeholder: "mm.dd.yyyy",
leapday: "02.29.",
separator: '.',
separator: ".",
alias: "mm/dd/yyyy"
},
'mm-dd-yyyy': {
"mm-dd-yyyy": {
mask: "1-2-y",
placeholder: "mm-dd-yyyy",
leapday: "02-29-",
separator: '-',
separator: "-",
alias: "mm/dd/yyyy"
},
'yyyy.mm.dd': {
"yyyy.mm.dd": {
mask: "y.1.2",
placeholder: "yyyy.mm.dd",
leapday: ".02.29",
separator: '.',
separator: ".",
alias: "yyyy/mm/dd"
},
'yyyy-mm-dd': {
"yyyy-mm-dd": {
mask: "y-1-2",
placeholder: "yyyy-mm-dd",
leapday: "-02-29",
separator: '-',
separator: "-",
alias: "yyyy/mm/dd"
},
'datetime': {
datetime: {
mask: "1/2/y h:s",

@@ -353,99 +324,75 @@ placeholder: "dd/mm/yyyy hh:mm",

regex: {
hrspre: new RegExp("[012]"), //hours pre
hrspre: new RegExp("[012]"),
hrs24: new RegExp("2[0-4]|1[3-9]"),
hrs: new RegExp("[01][0-9]|2[0-4]"), //hours
hrs: new RegExp("[01][0-9]|2[0-4]"),
ampm: new RegExp("^[a|p|A|P][m|M]"),
mspre: new RegExp("[0-5]"), //minutes/seconds pre
mspre: new RegExp("[0-5]"),
ms: new RegExp("[0-5][0-9]")
},
timeseparator: ':',
hourFormat: "24", // or 12
timeseparator: ":",
hourFormat: "24",
definitions: {
'h': { //hours
validator: function (chrs, maskset, pos, strict, opts) {
if (opts.hourFormat == "24") {
if (parseInt(chrs, 10) == 24) {
maskset.buffer[pos - 1] = "0";
maskset.buffer[pos] = "0";
return { "refreshFromBuffer": { start: pos - 1, end: pos }, "c": "0" };
}
}
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) {
if (chrs.charAt(1) == opts.timeseparator || "-.:".indexOf(chrs.charAt(1)) != -1) {
isValid = opts.regex.hrs.test("0" + chrs.charAt(0));
if (isValid) {
maskset.buffer[pos - 1] = "0";
maskset.buffer[pos] = chrs.charAt(0);
pos++;
return { "refreshFromBuffer": { start: pos - 2, end: pos }, "pos": pos, "c": opts.timeseparator };
}
}
}
if (isValid && opts.hourFormat !== "24" && opts.regex.hrs24.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);
if (tmp == 24) {
maskset.buffer[pos + 5] = "a";
maskset.buffer[pos + 6] = "m";
} else {
maskset.buffer[pos + 5] = "p";
maskset.buffer[pos + 6] = "m";
}
tmp = tmp - 12;
if (tmp < 10) {
maskset.buffer[pos] = tmp.toString();
maskset.buffer[pos - 1] = "0";
} else {
maskset.buffer[pos] = tmp.toString().charAt(1);
maskset.buffer[pos - 1] = tmp.toString().charAt(0);
}
return { "refreshFromBuffer": { start: pos - 1, end: pos + 6 }, "c": maskset.buffer[pos] };
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) {
prevalidator: [ {
validator: function(chrs, maskset, pos, strict, opts) {
var isValid = opts.regex.hrspre.test(chrs);
if (!strict && !isValid) {
isValid = opts.regex.hrs.test("0" + chrs);
if (isValid) {
maskset.buffer[pos] = "0";
pos++;
return { "pos": pos };
}
}
return isValid;
}, cardinality: 1
}]
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
pos++, {
pos: pos
});
},
cardinality: 1
} ]
},
's': { //seconds || minutes
s: {
validator: "[0-5][0-9]",
cardinality: 2,
prevalidator: [
{
validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.regex.mspre.test(chrs);
if (!strict && !isValid) {
isValid = opts.regex.ms.test("0" + chrs);
if (isValid) {
maskset.buffer[pos] = "0";
pos++;
return { "pos": pos };
}
}
return isValid;
}, cardinality: 1
}]
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': { //am/pm
validator: function (chrs, maskset, pos, strict, opts) {
t: {
validator: function(chrs, maskset, pos, strict, opts) {
return opts.regex.ampm.test(chrs + "m");

@@ -457,6 +404,6 @@ },

},
insertMode: false,
autoUnmask: false
insertMode: !1,
autoUnmask: !1
},
'datetime12': {
datetime12: {
mask: "1/2/y h:s t\\m",

@@ -467,3 +414,3 @@ placeholder: "dd/mm/yyyy hh:mm xm",

},
'hh:mm t': {
"hh:mm t": {
mask: "h:s t\\m",

@@ -474,3 +421,3 @@ placeholder: "hh:mm xm",

},
'h:s t': {
"h:s t": {
mask: "h:s t\\m",

@@ -481,27 +428,25 @@ placeholder: "hh:mm xm",

},
'hh:mm:ss': {
"hh:mm:ss": {
mask: "h:s:s",
placeholder: "hh:mm:ss",
alias: "datetime",
autoUnmask: false
autoUnmask: !1
},
'hh:mm': {
"hh:mm": {
mask: "h:s",
placeholder: "hh:mm",
alias: "datetime",
autoUnmask: false
autoUnmask: !1
},
'date': {
alias: "dd/mm/yyyy" // "mm/dd/yyyy"
date: {
alias: "dd/mm/yyyy"
},
'mm/yyyy': {
"mm/yyyy": {
mask: "1/y",
placeholder: "mm/yyyy",
leapday: "donotuse",
separator: '/',
separator: "/",
alias: "mm/dd/yyyy"
}
});
return $.fn.inputmask;
}));
}), $.fn.inputmask;
});

@@ -6,29 +6,20 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.26
* Version: 3.1.27
*/
(function (factory) {if (typeof define === 'function' && define.amd) {define(["jquery","./jquery.inputmask"], factory);} else {factory(jQuery);}}/*
Input Mask plugin extensions
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: 0.0.0
Optional extensions on the jquery.inputmask base
*/
(function ($) {
//extra definitions
$.extend($.inputmask.defaults.definitions, {
'A': {
validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
!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" //auto uppercasing
casing: "upper"
},
'#': {
validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
"#": {
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
cardinality: 1,
casing: "upper"
}
});
$.extend($.inputmask.defaults.aliases, {
'url': {
}), $.extend($.inputmask.defaults.aliases, {
url: {
mask: "ir",

@@ -49,42 +40,35 @@ placeholder: "",

definitions: {
'i': {
validator: function (chrs, maskset, pos, strict, opts) {
return true;
i: {
validator: function() {
return !0;
},
cardinality: 8,
prevalidator: (function () {
var result = [], prefixLimit = 8;
for (var i = 0; i < prefixLimit; i++) {
result[i] = (function () {
var j = i;
return {
validator: function (chrs, maskset, pos, strict, opts) {
if (opts.regex["urlpre" + (j + 1)]) {
var tmp = chrs, k;
if (((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) {
pos = pos - j;
for (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;
} else {
return false;
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
};
}
}, cardinality: j
};
})();
}
return isValid;
}
return !1;
},
cardinality: j
};
}();
return result;
})()
}()
},
"r": {
r: {
validator: ".",

@@ -94,17 +78,13 @@ cardinality: 50

},
insertMode: false,
autoUnmask: false
insertMode: !1,
autoUnmask: !1
},
"ip": { //ip-address mask
ip: {
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
definitions: {
'i': {
validator: function (chrs, maskset, pos, strict, opts) {
if (pos - 1 > -1 && maskset.buffer[pos - 1] != ".") {
chrs = maskset.buffer[pos - 1] + chrs;
if (pos - 2 > -1 && maskset.buffer[pos - 2] != ".") {
chrs = maskset.buffer[pos - 2] + chrs;
} else chrs = "0" + chrs;
} else chrs = "00" + chrs;
return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
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);
},

@@ -115,12 +95,11 @@ cardinality: 1

},
"email": {
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,20}][.*{2,6}][.*{1,2}]",
greedy: false,
onBeforePaste: function (pastedValue, opts) {
pastedValue = pastedValue.toLowerCase();
return pastedValue.replace("mailto:", "");
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!#$%&'*+/=?^_`{|}~\-]",
"*": {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
cardinality: 1,

@@ -131,4 +110,3 @@ casing: "lower"

}
});
return $.fn.inputmask;
}));
}), $.fn.inputmask;
});

@@ -6,200 +6,161 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.26
* Version: 3.1.27
*/
(function (factory) {if (typeof define === 'function' && define.amd) {define(["jquery","./jquery.inputmask"], factory);} else {factory(jQuery);}}/*
Input Mask plugin extensions
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: 0.0.0
Optional extensions on the jquery.inputmask base
*/
(function ($) {
//number aliases
$.extend($.inputmask.defaults.aliases, {
'numeric': {
mask: function (opts) {
if (opts.repeat !== 0 && isNaN(opts.integerDigits)) {
opts.integerDigits = opts.repeat;
!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.repeat = 0;
if (opts.groupSeparator == opts.radixPoint) { //treat equal separator and radixpoint
if (opts.radixPoint == ".")
opts.groupSeparator = ",";
else if (opts.radixPoint == ",")
opts.groupSeparator = ".";
else opts.groupSeparator = "";
}
if (opts.groupSeparator === " ") { //prevent conflict with default skipOptionalPartCharacter
opts.skipOptionalPartCharacter = undefined;
}
opts.autoGroup = opts.autoGroup && opts.groupSeparator != "";
if (opts.autoGroup && isFinite(opts.integerDigits)) {
var seps = Math.floor(opts.integerDigits / opts.groupSize);
var mod = opts.integerDigits % opts.groupSize;
opts.integerDigits += mod == 0 ? seps - 1 : seps;
}
opts.definitions[";"] = opts.definitions["~"]; //clone integer def for decimals
opts.definitions[";"] = opts.definitions["~"];
var mask = opts.prefix;
mask += "[+]";
mask += "~{1," + opts.integerDigits + "}";
if (opts.digits != undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
if (opts.digitsOptional)
mask += "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]";
else mask += (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}";
}
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;
return mask;
},
placeholder: "",
greedy: false,
digits: "*", //number of fractionalDigits
digitsOptional: true,
groupSeparator: "",//",", // | "."
greedy: !1,
digits: "*",
digitsOptional: !0,
groupSeparator: "",
radixPoint: ".",
radixFocus: !0,
groupSize: 3,
autoGroup: false,
allowPlus: true,
allowMinus: true,
integerDigits: "+", //number of integerDigits
autoGroup: !1,
allowPlus: !0,
allowMinus: !0,
integerDigits: "+",
prefix: "",
suffix: "",
rightAlign: true,
decimalProtect: true, //do not allow assumption of decimals input without entering the radixpoint
postFormat: function (buffer, pos, reformatOnly, opts) { //this needs to be removed // this is crap
var needsRefresh = false, charAtPos = buffer[pos];
if (opts.groupSeparator == "" ||
($.inArray(opts.radixPoint, buffer) != -1 && pos >= $.inArray(opts.radixPoint, buffer)) ||
new RegExp('[-\+]').test(charAtPos)
) return { pos: pos };
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();
if (charAtPos == opts.groupSeparator) {
cbuf.splice(pos--, 1);
charAtPos = cbuf[pos];
}
if (reformatOnly) cbuf[pos] = "?"; else cbuf.splice(pos, 0, "?"); //set position indicator
var bufVal = cbuf.join('');
if (opts.autoGroup || (reformatOnly && bufVal.indexOf(opts.groupSeparator) != -1)) {
charAtPos == opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
var bufVal = cbuf.join("");
if (opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
needsRefresh = bufVal.indexOf(opts.groupSeparator) == 0;
bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), '');
needsRefresh = 0 == bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
var radixSplit = bufVal.split(opts.radixPoint);
bufVal = radixSplit[0];
if (bufVal != (opts.prefix + "?0") && bufVal.length >= (opts.groupSize + opts.prefix.length)) {
needsRefresh = true;
var reg = new RegExp('([-\+]?[\\d\?]+)([\\d\?]{' + opts.groupSize + '})');
while (reg.test(bufVal)) {
bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2');
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
}
if (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);
}
if (radixSplit.length > 1)
bufVal += opts.radixPoint + radixSplit[1];
radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
}
buffer.length = bufVal.length; //align the length
for (var i = 0, l = bufVal.length; i < l; i++) {
buffer[i] = bufVal.charAt(i);
}
buffer.length = bufVal.length;
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
var newPos = $.inArray("?", buffer);
if (reformatOnly) buffer[newPos] = charAtPos; else buffer.splice(newPos, 1);
return { pos: newPos, "refreshFromBuffer": needsRefresh };
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 && opts.placeholder.charAt(0) != "0") {
onKeyDown: function(e, buffer, caretPos, opts) {
if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
var radixPosition = $.inArray(opts.radixPoint, buffer);
if (radixPosition != -1 && isFinite(opts.digits)) {
for (var i = 1; i <= opts.digits; i++) {
if (buffer[radixPosition + i] == undefined || buffer[radixPosition + i] == opts.placeholder.charAt(0)) buffer[radixPosition + i] = "0";
}
return { "refreshFromBuffer": { start: ++radixPosition, end: radixPosition + opts.digits } };
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, true, opts);
rslt.caret = rslt.pos + 1;
return rslt;
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 /*&& String.fromCharCode(k) == opts.radixPoint*/) {
var rslt = opts.postFormat(buffer, caretPos - 1, true, opts);
rslt.caret = rslt.pos + 1;
return 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;
}
},
regex: {
integerPart: function (opts) { return new RegExp('[-\+]?\\d+'); }
integerPart: function() {
return new RegExp("[-+]?\\d+");
},
integerNPart: function() {
return new RegExp("\\d+");
}
},
negationhandler: function (chrs, buffer, pos, strict, opts) {
if (!strict && opts.allowMinus && chrs === "-") {
var matchRslt = buffer.join('').match(opts.regex.integerPart(opts));
if (matchRslt.length > 0) {
if (buffer[matchRslt.index] == "+") {
return { "pos": matchRslt.index, "c": "-", "remove": matchRslt.index, "caret": pos };
} else if (buffer[matchRslt.index] == "-") {
return { "remove": matchRslt.index, "caret": pos - 1 };
} else {
return { "pos": matchRslt.index, "c": "-", "caret": pos + 1 };
}
}
signHandler: function(chrs, buffer, pos, strict, opts) {
if (!strict && (opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs)) {
var matchRslt = buffer.join("").match(opts.regex.integerPart(opts));
if (matchRslt && matchRslt.length > 0 && "0" !== matchRslt[matchRslt.index]) return buffer[matchRslt.index] == ("-" === chrs ? "+" : "-") ? {
pos: matchRslt.index,
c: chrs,
remove: matchRslt.index,
caret: pos
} : buffer[matchRslt.index] == ("-" === chrs ? "-" : "+") ? {
remove: matchRslt.index,
caret: pos - 1
} : {
pos: matchRslt.index,
c: chrs,
caret: pos + 1
};
}
return false;
return !1;
},
radixhandler: function (chrs, maskset, pos, strict, opts) {
radixHandler: function(chrs, maskset, pos, strict, opts) {
if (!strict && chrs === opts.radixPoint) {
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join('').match(opts.regex.integerPart(opts));
if (radixPos != -1) {
if (maskset["validPositions"][radixPos - 1])
return { "caret": radixPos + 1 };
else return { "pos": integerValue.index, c: integerValue[0], "caret": radixPos + 1 };
}
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
if (-1 != radixPos) return maskset.validPositions[radixPos - 1] ? {
caret: radixPos + 1
} : {
pos: integerValue.index,
c: integerValue[0],
caret: radixPos + 1
};
}
return false;
return !1;
},
leadingZeroHandler: function (chrs, maskset, pos, strict, opts) {
var matchRslt = maskset.buffer.join('').match(opts.regex.integerPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
if (matchRslt && !strict && (radixPosition == -1 || matchRslt.index < radixPosition)) {
if (matchRslt["0"].indexOf("0") == 0 && pos >= opts.prefix.length) {
if (radixPosition == -1 || (pos <= radixPosition && maskset["validPositions"][radixPosition] == undefined)) {
maskset.buffer.splice(matchRslt.index, 1);
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index;
return { "pos": pos, "remove": matchRslt.index };
} else if (pos > matchRslt.index && pos <= radixPosition) {
maskset.buffer.splice(matchRslt.index, 1);
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index;
return { "pos": pos, "remove": matchRslt.index };
}
} else if (chrs == "0" && pos <= matchRslt.index) {
return false;
}
}
return true;
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].indexOf("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
};
} else if ("0" == chrs && pos <= matchRslt.index) return !1;
return !0;
},
definitions: {
'~': {
validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.negationhandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {
isValid = opts.radixhandler(chrs, maskset, pos, strict, opts);
if (!isValid) {
isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
if (isValid === true) {
isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts);
if (isValid === true) {
//handle overwrite when fixed precision
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
if (opts.digitsOptional === false && pos > radixPosition && !strict) {
return { "pos": pos, "remove": pos };
} else return { pos: pos };
}
}
}
"~": {
validator: function(chrs, maskset, pos, strict, opts) {
var isValid = opts.signHandler(chrs, maskset.buffer, 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);
return opts.digitsOptional === !1 && pos > radixPosition && !strict ? {
pos: pos,
remove: pos
} : {
pos: pos
};
}
return isValid;

@@ -210,23 +171,25 @@ },

},
'+': {
validator: function (chrs, maskset, pos, strict, opts) {
var signed = "[";
if (opts.allowMinus === true) signed += "-";
if (opts.allowPlus === true) signed += "\+";
signed += "]";
return new RegExp(signed).test(chrs);
"+": {
validator: function(chrs, maskset, pos, strict, opts) {
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {
var signed = "[";
opts.allowMinus === !0 && (signed += "-"), opts.allowPlus === !0 && (signed += "+"),
signed += "]", isValid = new RegExp(signed).test(chrs);
}
return isValid;
},
cardinality: 1,
prevalidator: null,
placeholder: ''
placeholder: ""
},
':': {
validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.negationhandler(chrs, maskset.buffer, pos, strict, opts);
":": {
validator: function(chrs, maskset, pos, strict, opts) {
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {
var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
isValid = new RegExp(radix).test(chrs);
if (isValid && maskset["validPositions"][pos] && maskset["validPositions"][pos]["match"].placeholder == opts.radixPoint) {
isValid = { "pos": pos, "remove": pos };
}
isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder == opts.radixPoint && (isValid = {
pos: pos,
remove: pos
});
}

@@ -237,48 +200,31 @@ return isValid;

prevalidator: null,
placeholder: function (opts) { return opts.radixPoint; }
placeholder: function(opts) {
return opts.radixPoint;
}
}
},
insertMode: true,
autoUnmask: false,
onUnMask: function (maskedValue, unmaskedValue, opts) {
insertMode: !0,
autoUnmask: !1,
onUnMask: function(maskedValue, unmaskedValue, opts) {
var processValue = maskedValue.replace(opts.prefix, "");
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), ".");
return processValue;
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();
//verify separator positions
opts.postFormat(bufClone, 0, true, opts);
if (bufClone.join('') != maskedValue) return false;
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, "");
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), ".");
return isFinite(processValue);
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 (isFinite(initialValue)) {
return initialValue.toString().replace(".", opts.radixPoint);
} else {
var kommaMatches = initialValue.match(/,/g);
var dotMatches = initialValue.match(/\./g);
if (dotMatches && kommaMatches) {
if (dotMatches.length > kommaMatches.length) {
initialValue = initialValue.replace(/\./g, "");
initialValue = initialValue.replace(",", opts.radixPoint);
} else if (kommaMatches.length > dotMatches.length) {
initialValue = initialValue.replace(/,/g, "");
initialValue = initialValue.replace(".", opts.radixPoint);
}
} else {
initialValue = initialValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
}
return initialValue;
}
onBeforeMask: function(initialValue, opts) {
if (isFinite(initialValue)) return initialValue.toString().replace(".", opts.radixPoint);
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
return 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.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
initialValue;
}
},
'currency': {
currency: {
prefix: "$ ",

@@ -289,17 +235,16 @@ groupSeparator: ",",

placeholder: "0",
autoGroup: true,
autoGroup: !0,
digits: 2,
digitsOptional: false,
clearMaskOnLostFocus: false,
decimalProtect: true,
digitsOptional: !1,
clearMaskOnLostFocus: !1,
decimalProtect: !0
},
'decimal': {
decimal: {
alias: "numeric"
},
'integer': {
integer: {
alias: "numeric",
digits: "0"
}
});
return $.fn.inputmask;
}));
}), $.fn.inputmask;
});

@@ -6,35 +6,20 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.26
* Version: 3.1.27
*/
(function (factory) {if (typeof define === 'function' && define.amd) {define(["jquery","./jquery.inputmask"], factory);} else {factory(jQuery);}}/*
Input Mask plugin extensions
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: 0.0.0
Phone extension.
When using this extension make sure you specify the correct url to get the masks
$(selector).inputmask("phone", {
url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
onKeyValidation: function () { //show some metadata in the console
console.log($(this).inputmask("getmetadata")["cd"]);
}
});
*/
(function ($) {
$.extend($.inputmask.defaults.aliases, {
'phone': {
!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",
mask: function (opts) {
mask: function(opts) {
opts.definitions = {
'p': {
validator: function () { return false; },
p: {
validator: function() {
return !1;
},
cardinality: 1
},
'#': {
"#": {
validator: "[0-9]",

@@ -45,19 +30,17 @@ cardinality: 1

var maskList = [];
$.ajax({
return $.ajax({
url: opts.url,
async: false,
dataType: 'json',
success: function (response) {
async: !1,
dataType: "json",
success: function(response) {
maskList = response;
}
});
maskList.splice(0, 0, opts.maskInit);
maskList.sort(function (a, b) { return a.length - b.length; });
return maskList;
}), maskList.splice(0, 0, opts.maskInit), maskList.sort(function(a, b) {
return a.length - b.length;
}), maskList;
},
nojumps: true,
nojumps: !0,
nojumpsThreshold: 1
},
'phonebe': {
phonebe: {
alias: "phone",

@@ -68,4 +51,3 @@ url: "phone-codes/phone-be.js",

}
});
return $.fn.inputmask;
}));
}), $.fn.inputmask;
});

@@ -6,155 +6,99 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.26
* Version: 3.1.27
*/
(function (factory) {if (typeof define === 'function' && define.amd) {define(["jquery","./jquery.inputmask"], factory);} else {factory(jQuery);}}/*
Input Mask plugin extensions
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: 0.0.0
Regex extensions on the jquery.inputmask base
Allows for using regular expressions as a mask
*/
(function ($) {
$.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"}
'Regex': {
!function(factory) {
"function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
}(function($) {
return $.extend($.inputmask.defaults.aliases, {
Regex: {
mask: "r",
greedy: false,
greedy: !1,
repeat: "*",
regex: null,
regexTokens: null,
//Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex
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(''));
isComplete: function(buffer, opts) {
return new RegExp(opts.regex).test(buffer.join(""));
},
definitions: {
'r': {
validator: function (chrs, maskset, pos, strict, opts) {
r: {
validator: function(chrs, maskset, pos, strict, opts) {
function regexToken(isGroup, isQuantifier) {
this.matches = [];
this.isGroup = isGroup || false;
this.isQuantifier = isQuantifier || false;
this.quantifier = { min: 1, max: 1 };
this.repeaterPart = undefined;
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
this.quantifier = {
min: 1,
max: 1
}, this.repeaterPart = void 0;
}
function analyseRegex() {
var currentToken = new regexToken(), match, m, opengroups = [];
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;
opts.regexTokens = [];
case ")":
var groupToken = opengroups.pop();
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
break;
// The tokenizer regex does most of the tokenization grunt work
while (match = opts.tokenizer.exec(opts.regex)) {
m = match[0];
switch (m.charAt(0)) {
case "(": // Group opening
opengroups.push(new regexToken(true));
break;
case ")": // Group closing
var groupToken = opengroups.pop();
if (opengroups.length > 0) {
opengroups[opengroups.length - 1]["matches"].push(groupToken);
} else {
currentToken.matches.push(groupToken);
}
break;
case "{": case "+": case "*": //Quantifier
var quantifierToken = new regexToken(false, true);
m = m.replace(/[{}]/g, "");
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = mq.length == 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
quantifierToken.quantifier = { min: mq0, max: mq1 };
if (opengroups.length > 0) {
var matches = opengroups[opengroups.length - 1]["matches"];
match = matches.pop();
if (!match["isGroup"]) {
var groupToken = new regexToken(true);
groupToken.matches.push(match);
match = groupToken;
}
matches.push(match);
matches.push(quantifierToken);
} else {
match = currentToken.matches.pop();
if (!match["isGroup"]) {
var groupToken = new regexToken(true);
groupToken.matches.push(match);
match = groupToken;
}
currentToken.matches.push(match);
currentToken.matches.push(quantifierToken);
}
break;
default:
if (opengroups.length > 0) {
opengroups[opengroups.length - 1]["matches"].push(m);
} else {
currentToken.matches.push(m);
}
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);
}
if (currentToken.matches.length > 0)
opts.regexTokens.push(currentToken);
};
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
}
function validateRegexToken(token, fromGroup) {
var isvalid = false;
if (fromGroup) {
regexPart += "(";
openGroupCount++;
}
for (var mndx = 0; mndx < token["matches"].length; mndx++) {
var matchToken = token["matches"][mndx];
if (matchToken["isGroup"] == true) {
isvalid = validateRegexToken(matchToken, true);
} else if (matchToken["isQuantifier"] == true) {
var crrntndx = $.inArray(matchToken, token["matches"]),
matchGroup = token["matches"][crrntndx - 1];
var regexPartBak = regexPart;
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)) {
while (matchToken["repeaterPart"] && matchToken["repeaterPart"] != regexPart && matchToken["repeaterPart"].length > regexPart.length) {
isvalid = validateRegexToken(matchGroup, true);
if (isvalid) break;
}
isvalid = isvalid || validateRegexToken(matchGroup, true);
if (isvalid) matchToken["repeaterPart"] = regexPart;
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; i < qm; i++) {
isvalid = validateRegexToken(matchGroup, true);
if (isvalid) break;
}
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 (matchToken["matches"] != undefined) {
for (var k = 0; k < matchToken.length; k++) {
isvalid = validateRegexToken(matchToken[k], fromGroup);
if (isvalid) break;
}
} else {
} 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; j < openGroupCount; j++) {
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; l < tl; l++) {
if (matchToken.charAt(l) == "\\") continue;
testExp = regexPart;
testExp += matchToken.substr(0, l + 1);
testExp = testExp.replace(/\|$/, "");
for (var j = 0; j < openGroupCount; j++) {
testExp += ")";
}
var exp = new RegExp("^(" + testExp + ")$");
isvalid = exp.test(bufferStr);
if (isvalid) break;
}
} 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;
}

@@ -165,25 +109,11 @@ regexPart += matchToken;

}
if (fromGroup) {
regexPart += ")";
openGroupCount--;
}
return isvalid;
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
}
if (opts.regexTokens == null) {
analyseRegex();
}
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = false, openGroupCount = 0;
null == opts.regexTokens && analyseRegex();
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
cbuffer.splice(pos, 0, chrs);
var bufferStr = cbuffer.join('');
for (var i = 0; i < opts.regexTokens.length; i++) {
for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
var regexToken = opts.regexTokens[i];
isValid = validateRegexToken(regexToken, regexToken["isGroup"]);
if (isValid) break;
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
}
return isValid;

@@ -195,4 +125,3 @@ },

}
});
return $.fn.inputmask;
}));
}), $.fn.inputmask;
});

@@ -12,4 +12,4 @@ module.exports = function (grunt) {

function createConcatConfig(path) {
var concatConfig = {};
function createUglifyConfig(path) {
var uglifyConfig = {};
var srcFiles = grunt.file.expand(path + "/*.js");

@@ -19,6 +19,6 @@ for (var srcNdx in srcFiles) {

wrapAMDLoader(srcFiles[srcNdx], "build/" + dstFile, dstFile.indexOf("extension") == -1 ? ["jquery"] : ["jquery", "./jquery.inputmask"]);
concatConfig[dstFile] = {
uglifyConfig[dstFile] = {
dest: 'dist/inputmask/' + dstFile,
src: "build/" + dstFile,
options: { banner: createBanner(dstFile), stripBanners: true, }
options: { banner: createBanner(dstFile), beautify: true, mangle: false }
};

@@ -29,9 +29,15 @@ }

srcFiles.splice(0, 0, "js/jquery.inputmask.js");
concatConfig["inputmaskbundle"] = {
uglifyConfig["inputmaskbundle"] = {
files: {
'dist/<%= pkg.name %>.bundle.js': srcFiles
},
options: { banner: createBanner('<%= pkg.name %>.bundle'), stripBanners: true, }
options: { banner: createBanner('<%= pkg.name %>.bundle'), beautify: true, mangle: false }
}
return concatConfig;
uglifyConfig["inputmaskbundlemin"] = {
files: {
'dist/<%= pkg.name %>.bundle.min.js': srcFiles
},
options: { banner: createBanner('<%= pkg.name %>.bundle') }
}
return uglifyConfig;
}

@@ -49,3 +55,3 @@ function wrapAMDLoader(src, dst, dependencies) {

"factory(jQuery);" +
"}}" + stripClosureExecution() + ");";
"}}\n" + stripClosureExecution() + ");";
grunt.file.write(dst, dstContent);

@@ -57,3 +63,3 @@ }

pkg: grunt.file.readJSON('package.json'),
concat: createConcatConfig("js"),
uglify: createUglifyConfig("js"),
clean: ["dist"],

@@ -106,3 +112,3 @@ qunit: {

// Load the plugin that provides the tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');

@@ -115,9 +121,9 @@ grunt.loadNpmTasks('grunt-contrib-qunit');

grunt.registerTask('publish:patch', ['clean', 'bump:patch', 'concat', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:minor', ['clean', 'bump:minor', 'concat', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:major', ['clean', 'bump:major', 'concat', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:patch', ['clean', 'bump:patch', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:minor', ['clean', 'bump:minor', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
grunt.registerTask('publish:major', ['clean', 'bump:major', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
// Default task(s).
grunt.registerTask('default', ['clean', 'concat']);
grunt.registerTask('default', ['clean', 'uglify']);
};

@@ -11,3 +11,3 @@ {

],
"version": "3.1.26",
"version": "3.1.27",
"author": {

@@ -14,0 +14,0 @@ "name": "Robin Herbots",

@@ -106,3 +106,3 @@ /*

"email": {
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,20}][.*{2,6}][.*{1,2}]",
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
greedy: false,

@@ -109,0 +109,0 @@ onBeforePaste: function (pastedValue, opts) {

@@ -56,2 +56,3 @@ /*

radixPoint: ".",
radixFocus: true,
groupSize: 3,

@@ -128,15 +129,16 @@ autoGroup: false,

regex: {
integerPart: function (opts) { return new RegExp('[-\+]?\\d+'); }
integerPart: function (opts) { return new RegExp('[-\+]?\\d+'); },
integerNPart: function (opts) { return new RegExp('\\d+'); }
},
negationhandler: function (chrs, buffer, pos, strict, opts) {
if (!strict && opts.allowMinus && chrs === "-") {
signHandler: function (chrs, buffer, pos, strict, opts) {
if (!strict && (opts.allowMinus && chrs === "-" || opts.allowPlus && chrs === "+")) {
var matchRslt = buffer.join('').match(opts.regex.integerPart(opts));
if (matchRslt.length > 0) {
if (buffer[matchRslt.index] == "+") {
return { "pos": matchRslt.index, "c": "-", "remove": matchRslt.index, "caret": pos };
} else if (buffer[matchRslt.index] == "-") {
if (matchRslt && matchRslt.length > 0 && matchRslt[matchRslt.index] !== "0") {
if (buffer[matchRslt.index] == (chrs === "-" ? "+" : "-")) {
return { "pos": matchRslt.index, "c": chrs, "remove": matchRslt.index, "caret": pos };
} else if (buffer[matchRslt.index] == (chrs === "-" ? "-" : "+")) {
return { "remove": matchRslt.index, "caret": pos - 1 };
} else {
return { "pos": matchRslt.index, "c": "-", "caret": pos + 1 };
return { "pos": matchRslt.index, "c": chrs, "caret": pos + 1 };
}

@@ -147,3 +149,3 @@ }

},
radixhandler: function (chrs, maskset, pos, strict, opts) {
radixHandler: function (chrs, maskset, pos, strict, opts) {
if (!strict && chrs === opts.radixPoint) {

@@ -161,3 +163,3 @@ var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join('').match(opts.regex.integerPart(opts));

leadingZeroHandler: function (chrs, maskset, pos, strict, opts) {
var matchRslt = maskset.buffer.join('').match(opts.regex.integerPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
var matchRslt = maskset.buffer.join('').match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
if (matchRslt && !strict && (radixPosition == -1 || matchRslt.index < radixPosition)) {

@@ -183,5 +185,5 @@ if (matchRslt["0"].indexOf("0") == 0 && pos >= opts.prefix.length) {

validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.negationhandler(chrs, maskset.buffer, pos, strict, opts);
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {
isValid = opts.radixhandler(chrs, maskset, pos, strict, opts);
isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
if (!isValid) {

@@ -209,7 +211,11 @@ isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);

validator: function (chrs, maskset, pos, strict, opts) {
var signed = "[";
if (opts.allowMinus === true) signed += "-";
if (opts.allowPlus === true) signed += "\+";
signed += "]";
return new RegExp(signed).test(chrs);
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {
var signed = "[";
if (opts.allowMinus === true) signed += "-";
if (opts.allowPlus === true) signed += "\+";
signed += "]";
isValid = new RegExp(signed).test(chrs);
}
return isValid;
},

@@ -222,3 +228,3 @@ cardinality: 1,

validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.negationhandler(chrs, maskset.buffer, pos, strict, opts);
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
if (!isValid) {

@@ -225,0 +231,0 @@ var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";

{
"name": "jquery.inputmask",
"version": "3.1.26",
"version": "3.1.27",
"description": "jquery.inputmask is a jquery plugin which create an input mask.",

@@ -42,5 +42,4 @@ "main": [

"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-qunit": "^0.5.2",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-uglify": "^0.6.0",
"grunt-nuget": "^0.1.3",

@@ -47,0 +46,0 @@ "grunt-release": "^0.7.0",

@@ -61,2 +61,24 @@ module("keepStatic mask switching");

$("#testmask").remove();
});
test("{ mask: [\"99-9999-99\",\"99-99999-99\"] } - type 12123412 + add 1 upfront", function () {
var $fixture = $("#qunit-fixture");
$fixture.append('<input type="text" id="testmask" />');
$("#testmask").inputmask({ mask: ["99-9999-99", "99-99999-99"] });
$("#testmask").Type("12123412");
$.caret($("#testmask"), 0);
$("#testmask").Type("1");
equal(document.getElementById("testmask")._valueGet(), "11-21234-12", "Result " + document.getElementById("testmask")._valueGet());
$("#testmask").remove();
});
test("{ mask: [\"99-99999-9\",\"99-999999-9\"] } - type 121234561", function () {
var $fixture = $("#qunit-fixture");
$fixture.append('<input type="text" id="testmask" />');
$("#testmask").inputmask({ mask: ["99-99999-9", "99-999999-9"] });
$("#testmask").Type("121234561");
equal(document.getElementById("testmask")._valueGet(), "12-123456-1", "Result " + document.getElementById("testmask")._valueGet());
$("#testmask").remove();
});

@@ -198,3 +198,3 @@ module("Direction RTL");

asyncTest("inputmask({ mask: \"€ 999.999.999,99\", { numericInput: true, radixPoint: \",\" }); - 123 - radixpoint has no logic anymore in base", function () {
asyncTest("inputmask({ mask: \"€ 999.999.999,99\", { numericInput: true, radixPoint: \",\" }); - 123", function () {
var $fixture = $("#qunit-fixture");

@@ -201,0 +201,0 @@ $fixture.append('<input type="text" id="testmask" />');

@@ -481,7 +481,53 @@ #jquery.inputmask 3.x

#### onBeforeMask
Executes before masking the initial value to allow preprocessing of the initial value.
Function arguments: initialValue, opts
Function return: processedValue
```javascript
$(selector).inputmask({
alias: 'phonebe',
onBeforeMask: function (value, opts) {
var processedValue = value.replace(/^0/g, "");
if (processedValue.indexOf("32") > 1 || processedValue.indexOf("32") == -1) {
processedValue = "32" + processedValue;
}
return processedValue;
}
});
```
#### onBeforePaste
Executes before masking the pasted value to allow preprocessing of the pasted value.
Function arguments: pastedValue, opts
Function return: processedValue
```javascript
$(selector).inputmask({
mask: '9999 9999 9999 9999',
placeholder: ' ',
showMaskOnHover: false,
showMaskOnFocus: false,
onBeforePaste: function (pastedValue, opts) {
var processedValue = pastedValue;
//do something with it
return processedValue;
}
});
```
#### onUnMask
Executes after unmasking to allow post-processing of the unmaskedvalue. The arguments to the function are maskedValue, unmaskedValue.
Executes after unmasking to allow post-processing of the unmaskedvalue.
Function arguments: maskedValue, unmaskedValue
Function return: processedValue
```javascript

@@ -562,4 +608,20 @@ $(document).ready(function(){

#### radixPoint
#### nojumps: false, //do not jump over fixed parts in the mask
#### nojumpsThreshold: 0, //start nojumps as of
Define the radixpoint (decimal separator)
Default: ""
####radixFocus
Position the caret to the radixpoint on the initial click into the inputfield.
Default: false
#### nojumps
Do not jump over fixed parts in the mask.
Default: false
#### nojumpsThreshold
Start nojumps as of
Default: 0
#### keepStatic

@@ -566,0 +628,0 @@ Default: undefined (~false)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc