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.25 to 3.1.26

2

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

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

@@ -6,4 +6,493 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.25
* Version: 3.1.26
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.inputmask"],a):a(jQuery)}(function(a){return a.extend(a.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}]}}),a.extend(a.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(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length))),e=parseInt(a.concat(c.toString().slice(a.length)));return(isNaN(d)?!1:d>=b&&c>=d)||(isNaN(e)?!1:e>=b&&c>=e)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(d>b){for(var e=b.toString().slice(0,2),f=b.toString().slice(2,4);e+c>b;)e--;var g=e+f;return a>g?a:g}return d},onKeyUp:function(b,c,d,e){var f=a(this);if(b.ctrlKey&&b.keyCode==e.keyCode.RIGHT){var g=new Date;f.val(g.getDate().toString()+(g.getMonth()+1).toString()+g.getFullYear().toString())}},definitions:{1:{validator:function(a,b,c,d,e){var f=e.regex.val1.test(a);return d||f||a.charAt(1)!=e.separator&&-1=="-./".indexOf(a.charAt(1))||!(f=e.regex.val1.test("0"+a.charAt(0)))?f:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=1==a.length?e.regex.val1pre.test(a):e.regex.val1.test(a);return d||f||!(f=e.regex.val1.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},2:{validator:function(a,b,c,d,e){var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=e.regex.val2(e.separator).test(f+a);if(!d&&!g&&(a.charAt(1)==e.separator||-1!="-./".indexOf(a.charAt(1)))&&(g=e.regex.val2(e.separator).test(f+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(e.mask.indexOf("2")==e.mask.length-1&&g){var h=b.buffer.join("").substr(4,4)+a;if(h!=e.leapday)return!0;var i=parseInt(b.buffer.join("").substr(0,4),10);return i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}return g},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=1==a.length?e.regex.val2pre(e.separator).test(f+a):e.regex.val2(e.separator).test(f+a);return d||g||!(g=e.regex.val2(e.separator).test(f+"0"+a))?g:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,e){if(e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)){var f=b.buffer.join("").substr(0,6);if(f!=e.leapday)return!0;var g=parseInt(a,10);return g%4===0?g%100===0?g%400===0?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,1);if(f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,2),f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),b.buffer[c++]=g.charAt(1),{pos:c}}return f},cardinality:1},{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(f=e.isInYearRange(a[0]+g[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(1),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2),e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear)){var h=b.buffer.join("").substr(0,6);if(h!=e.leapday)f=!0;else{var i=parseInt(a,10);f=i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}}else f=!1;if(f)return b.buffer[c-1]=g.charAt(0),b.buffer[c++]=g.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return f},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyUp:function(b,c,d,e){var f=a(this);if(b.ctrlKey&&b.keyCode==e.keyCode.RIGHT){var g=new Date;f.val((g.getMonth()+1).toString()+g.getDate().toString()+g.getFullYear().toString())}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(b,c,d,e){var f=a(this);if(b.ctrlKey&&b.keyCode==e.keyCode.RIGHT){var g=new Date;f.val(g.getFullYear().toString()+(g.getMonth()+1).toString()+g.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(a,b,c,d,e){if("24"==e.hourFormat&&24==parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var f=e.regex.hrs.test(a);if(!d&&!f&&(a.charAt(1)==e.timeseparator||-1!="-.:".indexOf(a.charAt(1)))&&(f=e.regex.hrs.test("0"+a.charAt(0))))return b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator};if(f&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)){var g=parseInt(a,10);return 24==g?(b.buffer[c+5]="a",b.buffer[c+6]="m"):(b.buffer[c+5]="p",b.buffer[c+6]="m"),g-=12,10>g?(b.buffer[c]=g.toString(),b.buffer[c-1]="0"):(b.buffer[c]=g.toString().charAt(1),b.buffer[c-1]=g.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}}return f},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.hrspre.test(a);return d||f||!(f=e.regex.hrs.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.mspre.test(a);return d||f||!(f=e.regex.ms.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"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"}}),a.fn.inputmask});
(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
validator: "[01][0-9]|2[0-3]",
cardinality: 2,
prevalidator: [{ validator: "[0-2]", cardinality: 1 }]
},
's': { //seconds || minutes
validator: "[0-5][0-9]",
cardinality: 2,
prevalidator: [{ validator: "[0-5]", cardinality: 1 }]
},
'd': { //basic day
validator: "0[1-9]|[12][0-9]|3[01]",
cardinality: 2,
prevalidator: [{ validator: "[0-3]", cardinality: 1 }]
},
'm': { //basic month
validator: "0[1-9]|1[012]",
cardinality: 2,
prevalidator: [{ validator: "[01]", cardinality: 1 }]
},
'y': { //basic year
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]"), //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
},
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);
},
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--;
}
var maxxYear = maxYearPrefix + maxYearPostfix;
return minyear > maxxYear ? minyear : maxxYear;
}
return currentyear;
},
onKeyUp: function (e, buffer, caretPos, opts) {
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': { //val1 ~ day or month
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;
},
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
}]
},
'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;
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) };
}
}
}
//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
}]
},
'y': { //year
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;
},
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 };
}
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);
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
}
]
}
},
insertMode: false,
autoUnmask: false
},
'mm/dd/yyyy': {
placeholder: "mm/dd/yyyy",
alias: "dd/mm/yyyy", //reuse functionality of dd/mm/yyyy alias
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
},
leapday: "02/29/",
onKeyUp: function (e, buffer, caretPos, opts) {
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, buffer, caretPos, opts) {
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]"), //hours pre
hrs24: new RegExp("2[0-4]|1[3-9]"),
hrs: new RegExp("[01][0-9]|2[0-4]"), //hours
ampm: new RegExp("^[a|p|A|P][m|M]"),
mspre: new RegExp("[0-5]"), //minutes/seconds pre
ms: new RegExp("[0-5][0-9]")
},
timeseparator: ':',
hourFormat: "24", // or 12
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" };
}
}
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)) {
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 isValid;
},
cardinality: 2,
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
}]
},
's': { //seconds || minutes
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
}]
},
't': { //am/pm
validator: function (chrs, maskset, pos, strict, opts) {
return opts.regex.ampm.test(chrs + "m");
},
casing: "lower",
cardinality: 1
}
},
insertMode: false,
autoUnmask: false
},
'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: false
},
'hh:mm': {
mask: "h:s",
placeholder: "hh:mm",
alias: "datetime",
autoUnmask: false
},
'date': {
alias: "dd/mm/yyyy" // "mm/dd/yyyy"
},
'mm/yyyy': {
mask: "1/y",
placeholder: "mm/yyyy",
leapday: "donotuse",
separator: '/',
alias: "mm/dd/yyyy"
}
});
return $.fn.inputmask;
}));

@@ -6,4 +6,125 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.25
* Version: 3.1.26
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.inputmask"],a):a(jQuery)}(function(a){return a.extend(a.inputmask.defaults.definitions,{A:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"}}),a.extend(a.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 a=[],b=8,c=0;b>c;c++)a[c]=function(){var a=c;return{validator:function(b,c,d,e,f){if(f.regex["urlpre"+(a+1)]){var g,h=b;a+1-b.length>0&&(h=c.buffer.join("").substring(0,a+1-b.length)+""+h);var i=f.regex["urlpre"+(a+1)].test(h);if(!e&&!i){for(d-=a,g=0;g<f.defaultPrefix.length;g++)c.buffer[d]=f.defaultPrefix[g],d++;for(g=0;g<h.length-1;g++)c.buffer[d]=h[g],d++;return{pos:d}}return i}return!1},cardinality:a}}();return a}()},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(a,b,c){return c-1>-1&&"."!=b.buffer[c-1]?(a=b.buffer[c-1]+a,a=c-2>-1&&"."!=b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(a)},cardinality:1}}},email:{mask:"*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,20}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(a){return a=a.toLowerCase(),a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),a.fn.inputmask});
(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]",
cardinality: 1,
casing: "upper" //auto uppercasing
},
'#': {
validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
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 (chrs, maskset, pos, strict, opts) {
return true;
},
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;
}
}, cardinality: j
};
})();
}
return result;
})()
},
"r": {
validator: ".",
cardinality: 50
}
},
insertMode: false,
autoUnmask: false
},
"ip": { //ip-address mask
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);
},
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:", "");
},
definitions: {
'*': {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
cardinality: 1,
casing: "lower"
}
}
}
});
return $.fn.inputmask;
}));

@@ -6,4 +6,297 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.25
* Version: 3.1.26
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.inputmask"],a):a(jQuery)}(function(a){return a.extend(a.inputmask.defaults.aliases,{numeric:{mask:function(a){if(0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat),a.repeat=0,a.groupSeparator==a.radixPoint&&(a.groupSeparator="."==a.radixPoint?",":","==a.radixPoint?".":"")," "===a.groupSeparator&&(a.skipOptionalPartCharacter=void 0),a.autoGroup=a.autoGroup&&""!=a.groupSeparator,a.autoGroup&&isFinite(a.integerDigits)){var b=Math.floor(a.integerDigits/a.groupSize),c=a.integerDigits%a.groupSize;a.integerDigits+=0==c?b-1:b}a.definitions[";"]=a.definitions["~"];var d=a.prefix;return d+="[+]",d+="~{1,"+a.integerDigits+"}",void 0!=a.digits&&(isNaN(a.digits)||parseInt(a.digits)>0)&&(d+=a.digitsOptional?"["+(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}]":(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}"),d+=a.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,postFormat:function(b,c,d,e){var f=!1,g=b[c];if(""==e.groupSeparator||-1!=a.inArray(e.radixPoint,b)&&c>=a.inArray(e.radixPoint,b)||new RegExp("[-+]").test(g))return{pos:c};var h=b.slice();g==e.groupSeparator&&(h.splice(c--,1),g=h[c]),d?h[c]="?":h.splice(c,0,"?");var i=h.join("");if(e.autoGroup||d&&-1!=i.indexOf(e.groupSeparator)){var j=a.inputmask.escapeRegex.call(this,e.groupSeparator);f=0==i.indexOf(e.groupSeparator),i=i.replace(new RegExp(j,"g"),"");var k=i.split(e.radixPoint);if(i=k[0],i!=e.prefix+"?0"&&i.length>=e.groupSize+e.prefix.length){f=!0;for(var l=new RegExp("([-+]?[\\d?]+)([\\d?]{"+e.groupSize+"})");l.test(i);)i=i.replace(l,"$1"+e.groupSeparator+"$2"),i=i.replace(e.groupSeparator+e.groupSeparator,e.groupSeparator)}k.length>1&&(i+=e.radixPoint+k[1])}b.length=i.length;for(var m=0,n=i.length;n>m;m++)b[m]=i.charAt(m);var o=a.inArray("?",b);return d?b[o]=g:b.splice(o,1),{pos:o,refreshFromBuffer:f}},onKeyDown:function(b,c,d,e){if(b.keyCode==e.keyCode.TAB&&"0"!=e.placeholder.charAt(0)){var f=a.inArray(e.radixPoint,c);if(-1!=f&&isFinite(e.digits)){for(var g=1;g<=e.digits;g++)(void 0==c[f+g]||c[f+g]==e.placeholder.charAt(0))&&(c[f+g]="0");return{refreshFromBuffer:{start:++f,end:f+e.digits}}}}else if(e.autoGroup&&(b.keyCode==e.keyCode.DELETE||b.keyCode==e.keyCode.BACKSPACE)){var h=e.postFormat(c,d-1,!0,e);return h.caret=h.pos+1,h}},onKeyPress:function(a,b,c,d){if(d.autoGroup){var e=d.postFormat(b,c-1,!0,d);return e.caret=e.pos+1,e}},regex:{integerPart:function(){return new RegExp("[-+]?\\d+")}},negationhandler:function(a,b,c,d,e){if(!d&&e.allowMinus&&"-"===a){var f=b.join("").match(e.regex.integerPart(e));if(f.length>0)return"+"==b[f.index]?{pos:f.index,c:"-",remove:f.index,caret:c}:"-"==b[f.index]?{remove:f.index,caret:c-1}:{pos:f.index,c:"-",caret:c+1}}return!1},radixhandler:function(b,c,d,e,f){if(!e&&b===f.radixPoint){var g=a.inArray(f.radixPoint,c.buffer),h=c.buffer.join("").match(f.regex.integerPart(f));if(-1!=g)return c.validPositions[g-1]?{caret:g+1}:{pos:h.index,c:h[0],caret:g+1}}return!1},leadingZeroHandler:function(b,c,d,e,f){var g=c.buffer.join("").match(f.regex.integerPart(f)),h=a.inArray(f.radixPoint,c.buffer);if(g&&!e&&(-1==h||g.index<h))if(0==g[0].indexOf("0")&&d>=f.prefix.length){if(-1==h||h>=d&&void 0==c.validPositions[h])return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index};if(d>g.index&&h>=d)return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index}}else if("0"==b&&d<=g.index)return!1;return!0},definitions:{"~":{validator:function(b,c,d,e,f){var g=f.negationhandler(b,c.buffer,d,e,f);if(!g&&(g=f.radixhandler(b,c,d,e,f),!g&&(g=e?new RegExp("[0-9"+a.inputmask.escapeRegex.call(this,f.groupSeparator)+"]").test(b):new RegExp("[0-9]").test(b),g===!0&&(g=f.leadingZeroHandler(b,c,d,e,f),g===!0)))){var h=a.inArray(f.radixPoint,c.buffer);return f.digitsOptional===!1&&d>h&&!e?{pos:d,remove:d}:{pos:d}}return g},cardinality:1,prevalidator:null},"+":{validator:function(a,b,c,d,e){var f="[";return e.allowMinus===!0&&(f+="-"),e.allowPlus===!0&&(f+="+"),f+="]",new RegExp(f).test(a)},cardinality:1,prevalidator:null},":":{validator:function(b,c,d,e,f){var g=f.negationhandler(b,c.buffer,d,e,f);if(!g){var h="["+a.inputmask.escapeRegex.call(this,f.radixPoint)+"]";g=new RegExp(h).test(b),g&&c.validPositions[d]&&c.validPositions[d].match.placeholder==f.radixPoint&&(g={pos:d,remove:d})}return g},cardinality:1,prevalidator:null,placeholder:function(a){return a.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(b,c,d){var e=b.replace(d.prefix,"");return e=e.replace(d.suffix,""),e=e.replace(new RegExp(a.inputmask.escapeRegex.call(this,d.groupSeparator),"g"),"")},isComplete:function(b,c){var d=b.join(""),e=b.slice();if(c.postFormat(e,0,!0,c),e.join("")!=d)return!1;var f=d.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),f=f.replace(a.inputmask.escapeRegex.call(this,c.radixPoint),"."),isFinite(f)},onBeforeMask:function(b,c){if(isFinite(b))return b.toString().replace(".",c.radixPoint);var d=b.match(/,/g),e=b.match(/\./g);return e&&d?e.length>d.length?(b=b.replace(/\./g,""),b=b.replace(",",c.radixPoint)):d.length>e.length&&(b=b.replace(/,/g,""),b=b.replace(".",c.radixPoint)):b=b.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),b}},currency:{prefix:"$ ",groupSeparator:",",radixPoint:".",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1,decimalProtect:!0},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}}),a.fn.inputmask});
(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;
}
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
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 + "}";
}
mask += opts.suffix;
return mask;
},
placeholder: "",
greedy: false,
digits: "*", //number of fractionalDigits
digitsOptional: true,
groupSeparator: "",//",", // | "."
radixPoint: ".",
groupSize: 3,
autoGroup: false,
allowPlus: true,
allowMinus: true,
integerDigits: "+", //number of 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 };
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)) {
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
needsRefresh = bufVal.indexOf(opts.groupSeparator) == 0;
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 (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);
}
var newPos = $.inArray("?", buffer);
if (reformatOnly) buffer[newPos] = charAtPos; else buffer.splice(newPos, 1);
return { pos: newPos, "refreshFromBuffer": needsRefresh };
},
onKeyDown: function (e, buffer, caretPos, opts) {
if (e.keyCode == $.inputmask.keyCode.TAB && opts.placeholder.charAt(0) != "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 } };
}
} 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;
}
},
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;
}
},
regex: {
integerPart: function (opts) { 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 };
}
}
}
return false;
},
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 };
}
}
return false;
},
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;
},
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 };
}
}
}
}
return isValid;
},
cardinality: 1,
prevalidator: null
},
'+': {
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);
},
cardinality: 1,
prevalidator: null,
placeholder: ''
},
':': {
validator: function (chrs, maskset, pos, strict, opts) {
var isValid = opts.negationhandler(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 };
}
}
return isValid;
},
cardinality: 1,
prevalidator: null,
placeholder: function (opts) { return opts.radixPoint; }
}
},
insertMode: true,
autoUnmask: false,
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;
},
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;
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);
},
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;
}
}
},
'currency': {
prefix: "$ ",
groupSeparator: ",",
radixPoint: ".",
alias: "numeric",
placeholder: "0",
autoGroup: true,
digits: 2,
digitsOptional: false,
clearMaskOnLostFocus: false,
decimalProtect: true,
},
'decimal': {
alias: "numeric"
},
'integer': {
alias: "numeric",
digits: "0"
}
});
return $.fn.inputmask;
}));

@@ -6,4 +6,64 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.25
* Version: 3.1.26
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.inputmask"],a):a(jQuery)}(function(a){return a.extend(a.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",mask:function(b){b.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var c=[];return a.ajax({url:b.url,async:!1,dataType:"json",success:function(a){c=a}}),c.splice(0,0,b.maskInit),c.sort(function(a,b){return a.length-b.length}),c},nojumps:!0,nojumpsThreshold:1},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",maskInit:"+32(pp)pppppppp",nojumpsThreshold:4}}),a.fn.inputmask});
(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': {
url: "phone-codes/phone-codes.js",
maskInit: "+pp(pp)pppppppp",
mask: function (opts) {
opts.definitions = {
'p': {
validator: function () { return false; },
cardinality: 1
},
'#': {
validator: "[0-9]",
cardinality: 1
}
};
var maskList = [];
$.ajax({
url: opts.url,
async: false,
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;
},
nojumps: true,
nojumpsThreshold: 1
},
'phonebe': {
alias: "phone",
url: "phone-codes/phone-be.js",
maskInit: "+32(pp)pppppppp",
nojumpsThreshold: 4
}
});
return $.fn.inputmask;
}));

@@ -6,4 +6,191 @@ /*

* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.1.25
* Version: 3.1.26
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.inputmask"],a):a(jQuery)}(function(a){return a.extend(a.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(a,b){return new RegExp(b.regex).test(a.join(""))},definitions:{r:{validator:function(b,c,d,e,f){function g(a,b){this.matches=[],this.isGroup=a||!1,this.isQuantifier=b||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function h(){var a,b,c=new g,d=[];for(f.regexTokens=[];a=f.tokenizer.exec(f.regex);)switch(b=a[0],b.charAt(0)){case"(":d.push(new g(!0));break;case")":var e=d.pop();d.length>0?d[d.length-1].matches.push(e):c.matches.push(e);break;case"{":case"+":case"*":var h=new g(!1,!0);b=b.replace(/[{}]/g,"");var i=b.split(","),j=isNaN(i[0])?i[0]:parseInt(i[0]),k=1==i.length?j:isNaN(i[1])?i[1]:parseInt(i[1]);if(h.quantifier={min:j,max:k},d.length>0){var l=d[d.length-1].matches;if(a=l.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}l.push(a),l.push(h)}else{if(a=c.matches.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}c.matches.push(a),c.matches.push(h)}break;default:d.length>0?d[d.length-1].matches.push(b):c.matches.push(b)}c.matches.length>0&&f.regexTokens.push(c)}function i(b,c){var d=!1;c&&(k+="(",m++);for(var e=0;e<b.matches.length;e++){var f=b.matches[e];if(1==f.isGroup)d=i(f,!0);else if(1==f.isQuantifier){var g=a.inArray(f,b.matches),h=b.matches[g-1],j=k;if(isNaN(f.quantifier.max)){for(;f.repeaterPart&&f.repeaterPart!=k&&f.repeaterPart.length>k.length&&!(d=i(h,!0)););d=d||i(h,!0),d&&(f.repeaterPart=k),k=j+f.quantifier.max}else{for(var l=0,o=f.quantifier.max-1;o>l&&!(d=i(h,!0));l++);k=j+"{"+f.quantifier.min+","+f.quantifier.max+"}"}}else if(void 0!=f.matches)for(var p=0;p<f.length&&!(d=i(f[p],c));p++);else{var q;if("["==f.charAt(0)){q=k,q+=f;for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");d=s.test(n)}else for(var t=0,u=f.length;u>t;t++)if("\\"!=f.charAt(t)){q=k,q+=f.substr(0,t+1),q=q.replace(/\|$/,"");for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");if(d=s.test(n))break}k+=f}if(d)break}return c&&(k+=")",m--),d}null==f.regexTokens&&h();var j=c.buffer.slice(),k="",l=!1,m=0;j.splice(d,0,b);for(var n=j.join(""),o=0;o<f.regexTokens.length;o++){var g=f.regexTokens[o];if(l=i(g,g.isGroup))break}return l},cardinality:1}}}}),a.fn.inputmask});
(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': {
mask: "r",
greedy: false,
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(''));
},
definitions: {
'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;
}
function analyseRegex() {
var currentToken = new regexToken(), match, m, opengroups = [];
opts.regexTokens = [];
// 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;
}
}
if (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;
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;
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;
}
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 {
var testExp;
if (matchToken.charAt(0) == "[") {
testExp = regexPart;
testExp += matchToken;
for (var j = 0; j < openGroupCount; 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;
}
}
regexPart += matchToken;
}
if (isvalid) break;
}
if (fromGroup) {
regexPart += ")";
openGroupCount--;
}
return isvalid;
}
if (opts.regexTokens == null) {
analyseRegex();
}
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = false, openGroupCount = 0;
cbuffer.splice(pos, 0, chrs);
var bufferStr = cbuffer.join('');
for (var i = 0; i < opts.regexTokens.length; i++) {
var regexToken = opts.regexTokens[i];
isValid = validateRegexToken(regexToken, regexToken["isGroup"]);
if (isValid) break;
}
return isValid;
},
cardinality: 1
}
}
}
});
return $.fn.inputmask;
}));

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

function createUglifyConfig(path) {
var uglifyConfig = {};
function createConcatConfig(path) {
var concatConfig = {};
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"]);
uglifyConfig[dstFile] = {
concatConfig[dstFile] = {
dest: 'dist/inputmask/' + dstFile,
src: "build/" + dstFile,
options: { banner: createBanner(dstFile) }
options: { banner: createBanner(dstFile), stripBanners: true, }
};

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

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

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

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

@@ -105,3 +105,3 @@ qunit: {

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

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

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']);
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']);
// Default task(s).
grunt.registerTask('default', ['clean', 'uglify']);
grunt.registerTask('default', ['clean', 'concat']);
};

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

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

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

@@ -80,3 +80,3 @@ /*

var $input = $(this);
if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) {
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
var today = new Date();

@@ -276,3 +276,3 @@ $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());

var $input = $(this);
if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) {
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
var today = new Date();

@@ -290,3 +290,3 @@ $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());

var $input = $(this);
if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) {
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
var today = new Date();

@@ -293,0 +293,0 @@ $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());

@@ -38,3 +38,3 @@ /*

opts.definitions[";"] = opts.definitions["~"]; //clone integer def for decimals
var mask = opts.prefix;

@@ -106,3 +106,3 @@ mask += "[+]";

onKeyDown: function (e, buffer, caretPos, opts) {
if (e.keyCode == opts.keyCode.TAB && opts.placeholder.charAt(0) != "0") {
if (e.keyCode == $.inputmask.keyCode.TAB && opts.placeholder.charAt(0) != "0") {
var radixPosition = $.inArray(opts.radixPoint, buffer);

@@ -115,3 +115,3 @@ if (radixPosition != -1 && isFinite(opts.digits)) {

}
} else if (opts.autoGroup && (e.keyCode == opts.keyCode.DELETE || e.keyCode == opts.keyCode.BACKSPACE)) {
} else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
var rslt = opts.postFormat(buffer, caretPos - 1, true, opts);

@@ -214,3 +214,4 @@ rslt.caret = rslt.pos + 1;

cardinality: 1,
prevalidator: null
prevalidator: null,
placeholder: ''
},

@@ -231,3 +232,3 @@ ':': {

prevalidator: null,
placeholder: function(opts) { return opts.radixPoint; }
placeholder: function (opts) { return opts.radixPoint; }
}

@@ -234,0 +235,0 @@ },

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

@@ -42,2 +42,3 @@ "main": [

"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-qunit": "^0.5.2",

@@ -44,0 +45,0 @@ "grunt-contrib-uglify": "^0.5.1",

(function ($) {
$.keyCodes = {
ALT: 18, BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, COMMAND: 91, COMMAND_LEFT: 91, COMMAND_RIGHT: 93, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, MENU: 93, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38, WINDOWS: 91
}
$.caret = function (input, begin, end) {

@@ -47,3 +43,3 @@ var npt = input.jquery && input.length > 0 ? input[0] : input, range;

switch (keyCode) {
case $.keyCodes.LEFT: {
case $.inputmask.keyCode.LEFT: {
if (modifier == undefined) {

@@ -55,3 +51,3 @@ var pos = $.caret(this);

}
case $.keyCodes.RIGHT: {
case $.inputmask.keyCode.RIGHT: {
if (modifier == undefined) {

@@ -70,3 +66,3 @@ var pos = $.caret(this);

keydown.keyCode = keyCode;
if (modifier == $.keyCodes.CONTROL)
if (modifier == $.inputmask.keyCode.CONTROL)
keydown.ctrlKey = true;

@@ -77,3 +73,3 @@ }

keypress.keyCode = keyCode;
if (modifier == $.keyCodes.CONTROL)
if (modifier == $.inputmask.keyCode.CONTROL)
keypress.ctrlKey = true;

@@ -83,3 +79,3 @@ $(this).trigger(keypress);

keyup.keyCode = keyCode;
if (modifier == $.keyCodes.CONTROL)
if (modifier == $.inputmask.keyCode.CONTROL)
keyup.ctrlKey = true;

@@ -86,0 +82,0 @@ $(this).trigger(keyup);

@@ -44,3 +44,3 @@ module("Simple masking");

$("#testmask").Type("123");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
equal($("#testmask").val(), "12_.___.___", "Result " + $("#testmask").val());

@@ -108,7 +108,7 @@

$("#testmask").Type("123");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").Type("4");
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").Type("56");

@@ -131,8 +131,8 @@

$("#testmask").SendKey(51);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey(52);
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey(53);

@@ -155,3 +155,3 @@ $("#testmask").SendKey(54);

$.caret($("#testmask"), 3, 7);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -172,3 +172,3 @@ equal($("#testmask").val(), "123.789.___", "Result " + $("#testmask").val());

$.caret($("#testmask"), 3, 7);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -204,3 +204,3 @@ equal($("#testmask").val(), "123.789.___", "Result " + $("#testmask").val());

$("#testmask").Type("abe");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").Type("cd");

@@ -222,3 +222,3 @@

$.caret($("#testmask"), 5);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);

@@ -293,3 +293,3 @@ equal($("#testmask").val(), "23/0_/1973", "Result " + $("#testmask").val());

$.caret($("#testmask"), 8, 11);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
equal($("#testmask").val(), "(999)999-99__", "Result " + $("#testmask").val());

@@ -550,3 +550,3 @@

$("#testmask").Type("1234567890123");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);

@@ -566,3 +566,3 @@ equal($("#testmask").val(), "6703 1234 5678 9012 _", "Result " + $("#testmask").val());

$("#testmask").Type("6703670367036");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
equal($("#testmask").val(), "6703 6703 6703 6703 _", "Result " + $("#testmask").val());

@@ -569,0 +569,0 @@ start();

@@ -131,3 +131,3 @@ module("Date.Extensions");

$("#testmask")[0].focus();
$("#testmask").SendKey($.keyCodes.RIGHT, $.keyCodes.CONTROL);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT, $.inputmask.keyCode.CONTROL);
ok($("#testmask").val() != "dd/mm/yyyy", "Result " + $("#testmask").val());

@@ -152,6 +152,6 @@

$("#testmask").SendKey("3");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey("2");

@@ -253,3 +253,3 @@ $("#testmask").SendKey("0");

$.caret($("#testmask"), 0, 2);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -256,0 +256,0 @@ equal($("#testmask").val(), "dd/03/1973", "Result " + $("#testmask").val());

@@ -48,2 +48,15 @@ module("keepStatic mask switching");

$("#testmask").remove();
});
test("{ mask: [\"+55-99-9999-9999\", \"+55-99-99999-9999\", ], keepStatic: true } - type 12123451234 + backspace", function () {
var $fixture = $("#qunit-fixture");
$fixture.append('<input type="text" id="testmask" />');
$("#testmask").inputmask({ mask: ["+55-99-9999-9999", "+55-99-99999-9999"], keepStatic: true });
$("#testmask")[0].focus();
$("#testmask").Type("12123451234");
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
equal(document.getElementById("testmask")._valueGet(), "+55-12-1234-5123", "Result " + document.getElementById("testmask")._valueGet());
$("#testmask").remove();
});

@@ -99,3 +99,3 @@ module("Numeric.Extensions");

$("#testmask").Type("0.123");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);

@@ -320,6 +320,6 @@ equal($("#testmask").val(), "€ 0.12", "Result " + $("#testmask").val());

$("#testmask").Type("12345.123");
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);

@@ -337,8 +337,8 @@ equal($("#testmask").val(), "12,345", "Result " + $("#testmask").val());

$("#testmask").Type("12345.123");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").Type(".789");

@@ -373,10 +373,10 @@

//$("#testmask").click();
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -395,10 +395,10 @@ equal($("#testmask").val(), "12345", "Result " + $("#testmask").val());

//$("#testmask").click();
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -416,10 +416,10 @@ equal($("#testmask").val(), "12345", "Result " + $("#testmask").val());

$("#testmask").Type("12345.123");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").Type(".789");

@@ -564,5 +564,5 @@

$("#testmask").SendKey(",,..");
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.RIGHT); //needed in test
$("#testmask").SendKey($.keyCodes.RIGHT); //needed in test
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT); //needed in test
$("#testmask").SendKey($.inputmask.keyCode.RIGHT); //needed in test
$("#testmask").Type("45");

@@ -610,3 +610,3 @@

$.caret($("#testmask"), 0);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);

@@ -633,3 +633,3 @@ equal($("#testmask").val(), "234,567", "Result " + $("#testmask").val());

$.caret($("#testmask"), 1);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);

@@ -726,3 +726,3 @@ equal($("#testmask").val(), "234,567", "Result " + $("#testmask").val());

$("#testmask").Type("123.1");
$("#testmask").SendKey($.keyCodes.TAB);
$("#testmask").SendKey($.inputmask.keyCode.TAB);

@@ -729,0 +729,0 @@ equal($("#testmask").val(), "123.100", "Result " + $("#testmask").val());

@@ -12,8 +12,8 @@ module("Direction RTL");

$("#testmask").SendKey("3");
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey("4");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey("5");

@@ -38,7 +38,7 @@ $("#testmask").SendKey("6");

$("#testmask").SendKey("3");
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.RIGHT);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.RIGHT);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").SendKey("4");
$("#testmask").SendKey($.keyCodes.LEFT);
$("#testmask").SendKey($.inputmask.keyCode.LEFT);
$("#testmask").SendKey("5");

@@ -94,3 +94,3 @@ $("#testmask").SendKey("6");

$.caret($("#testmask"), 4, 7);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").Type("5");

@@ -113,3 +113,3 @@ start();

$.caret($("#testmask"), 4, 7);
$("#testmask").SendKey($.keyCodes.DELETE);
$("#testmask").SendKey($.inputmask.keyCode.DELETE);
$("#testmask").Type("5");

@@ -116,0 +116,0 @@ start();

@@ -94,3 +94,3 @@ module("Optional");

$("#testmask").Type("123123");
$("#testmask").SendKey($.keyCodes.SPACE);
$("#testmask").SendKey($.inputmask.keyCode.SPACE);
$("#testmask").Type("1234");

@@ -97,0 +97,0 @@ equal($("#testmask").val(), "123 123 1234", "Result " + $("#testmask").val());

@@ -86,7 +86,7 @@ module("Phone masks")

$.caret($("#testmask"), $("#testmask")[0].value.length); //for FF
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.keyCodes.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").SendKey($.inputmask.keyCode.BACKSPACE);
$("#testmask").Type("451234");

@@ -93,0 +93,0 @@ setTimeout(function () {

@@ -283,3 +283,3 @@ module("Regex masks")

$("#testmask")[0].focus();
$("#testmask").SendKey($.keyCodes.SPACE);
$("#testmask").SendKey($.inputmask.keyCode.SPACE);

@@ -286,0 +286,0 @@ equal($("#testmask").val(), " ", "Result " + $("#testmask").val());

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