|
@@ -3,7 +3,7 @@
|
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
|
* Copyright (c) 2010 - 2014 Robin Herbots
|
|
* Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 3.0.11
|
|
|
|
|
|
|
+* Version: 3.0.12
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
(function ($) {
|
|
(function ($) {
|
|
@@ -240,7 +240,7 @@
|
|
|
//maskset helperfunctions
|
|
//maskset helperfunctions
|
|
|
function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
|
|
function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
|
|
|
minimalPos = minimalPos || 0;
|
|
minimalPos = minimalPos || 0;
|
|
|
- var maskTemplate = [], ndxIntlzr, pos = 0, test;
|
|
|
|
|
|
|
+ var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos;
|
|
|
do {
|
|
do {
|
|
|
if (baseOnInput === true && getMaskSet()['validPositions'][pos]) {
|
|
if (baseOnInput === true && getMaskSet()['validPositions'][pos]) {
|
|
|
var validPos = getMaskSet()['validPositions'][pos];
|
|
var validPos = getMaskSet()['validPositions'][pos];
|
|
@@ -248,8 +248,12 @@
|
|
|
ndxIntlzr = validPos["locator"].slice();
|
|
ndxIntlzr = validPos["locator"].slice();
|
|
|
maskTemplate.push(test["fn"] == null ? test["def"] : (includeInput === true ? validPos["input"] : opts.placeholder.charAt(pos % opts.placeholder.length)));
|
|
maskTemplate.push(test["fn"] == null ? test["def"] : (includeInput === true ? validPos["input"] : opts.placeholder.charAt(pos % opts.placeholder.length)));
|
|
|
} else {
|
|
} else {
|
|
|
- var testPos = getTests(pos, ndxIntlzr, pos - 1), firstMatch = testPos[0]["match"];
|
|
|
|
|
- testPos = testPos[(minimalPos > pos || (opts.greedy || (firstMatch.optionality === true && firstMatch.newBlockMarker === false && firstMatch.optionalQuantifier !== true))) ? 0 : (testPos.length - 1)];
|
|
|
|
|
|
|
+ if (minimalPos > pos) {
|
|
|
|
|
+ var testPositions = getTests(pos, ndxIntlzr, pos - 1);
|
|
|
|
|
+ testPos = testPositions[0];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
|
|
|
|
+ }
|
|
|
test = testPos["match"];
|
|
test = testPos["match"];
|
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
|
maskTemplate.push(test["fn"] == null ? test["def"] : opts.placeholder.charAt(pos % opts.placeholder.length));
|
|
maskTemplate.push(test["fn"] == null ? test["def"] : opts.placeholder.charAt(pos % opts.placeholder.length));
|
|
@@ -296,9 +300,10 @@
|
|
|
var valid = true;
|
|
var valid = true;
|
|
|
for (i = pos; i <= lvp ;) {
|
|
for (i = pos; i <= lvp ;) {
|
|
|
var j = seekNext(i);
|
|
var j = seekNext(i);
|
|
|
|
|
+ if (i == j) valid = false;
|
|
|
var t = positionsClone[i];
|
|
var t = positionsClone[i];
|
|
|
if (t != undefined) {
|
|
if (t != undefined) {
|
|
|
- var nextTest = getTest(j, t["locator"].slice(), i);
|
|
|
|
|
|
|
+ var nextTest = getTest(j);
|
|
|
if (nextTest.fn == null && nextTest.def == "")
|
|
if (nextTest.fn == null && nextTest.def == "")
|
|
|
valid = false;
|
|
valid = false;
|
|
|
else if (t["match"].fn == null || t["match"].def == nextTest.def) {
|
|
else if (t["match"].fn == null || t["match"].def == nextTest.def) {
|
|
@@ -344,12 +349,22 @@
|
|
|
resetMaskSet(true);
|
|
resetMaskSet(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function getTest(pos, ndxIntlzr, tstPs) {
|
|
|
|
|
|
|
+ function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
|
|
|
|
+ var testPositions = getTests(pos, ndxIntlzr, tstPs), testPos;
|
|
|
|
|
+ for (var ndx in testPositions) {
|
|
|
|
|
+ testPos = testPositions[ndx];
|
|
|
|
|
+ if (opts.greedy || ((testPos["match"].optionality === false || testPos["match"].newBlockMarker === false) && testPos["match"].optionalQuantifier !== true)) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return testPos;
|
|
|
|
|
+ }
|
|
|
|
|
+ function getTest(pos) {
|
|
|
if (getMaskSet()['validPositions'][pos]) {
|
|
if (getMaskSet()['validPositions'][pos]) {
|
|
|
return getMaskSet()['validPositions'][pos]["match"];
|
|
return getMaskSet()['validPositions'][pos]["match"];
|
|
|
}
|
|
}
|
|
|
- var testPos = getTests(pos, ndxIntlzr, tstPs);
|
|
|
|
|
- return testPos[0]["match"];
|
|
|
|
|
|
|
+ return getTests(pos)[0]["match"];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getTests(pos, ndxIntlzr, tstPs) {
|
|
function getTests(pos, ndxIntlzr, tstPs) {
|
|
@@ -584,9 +599,7 @@
|
|
|
var pos, lvp = getLastValidPosition(), testPos = getMaskSet()["validPositions"][lvp],
|
|
var pos, lvp = getLastValidPosition(), testPos = getMaskSet()["validPositions"][lvp],
|
|
|
ndxIntlzr = testPos != undefined ? testPos["locator"].slice() : undefined;
|
|
ndxIntlzr = testPos != undefined ? testPos["locator"].slice() : undefined;
|
|
|
for (pos = lvp + 1; testPos == undefined || (testPos["match"]["fn"] != null || (testPos["match"]["fn"] == null && testPos["match"]["def"] != "")) ; pos++) {
|
|
for (pos = lvp + 1; testPos == undefined || (testPos["match"]["fn"] != null || (testPos["match"]["fn"] == null && testPos["match"]["def"] != "")) ; pos++) {
|
|
|
- testPos = getTests(pos, ndxIntlzr, pos - 1);
|
|
|
|
|
- var firstMatch = testPos[0]["match"];
|
|
|
|
|
- testPos = testPos[(opts.greedy || (firstMatch.optionality === true && firstMatch.newBlockMarker === false && firstMatch.optionalQuantifier !== true)) ? 0 : (testPos.length - 1)];
|
|
|
|
|
|
|
+ testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
|
}
|
|
}
|
|
|
maskLength = pos;
|
|
maskLength = pos;
|
|
@@ -664,11 +677,9 @@
|
|
|
pos, lvp = getLastValidPosition(), positions = {},
|
|
pos, lvp = getLastValidPosition(), positions = {},
|
|
|
ndxIntlzr = getMaskSet()["validPositions"][lvp]["locator"].slice(), testPos;
|
|
ndxIntlzr = getMaskSet()["validPositions"][lvp]["locator"].slice(), testPos;
|
|
|
for (pos = lvp + 1; pos < tmpBuffer.length; pos++) {
|
|
for (pos = lvp + 1; pos < tmpBuffer.length; pos++) {
|
|
|
- testPos = getTests(pos, ndxIntlzr, pos - 1);
|
|
|
|
|
- var firstMatch = testPos[0]["match"];
|
|
|
|
|
- testPos = testPos[(opts.greedy || (firstMatch.optionality === true && firstMatch.newBlockMarker === false && firstMatch.optionalQuantifier !== true)) ? 0 : (testPos.length - 1)];
|
|
|
|
|
- positions[pos] = testPos;
|
|
|
|
|
|
|
+ testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
ndxIntlzr = testPos["locator"].slice();
|
|
|
|
|
+ positions[pos] = testPos;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for (pos = tmpBuffer.length - 1; pos > lvp; pos--) {
|
|
for (pos = tmpBuffer.length - 1; pos > lvp; pos--) {
|
|
@@ -1848,7 +1859,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 3.0.11
|
|
|
|
|
|
|
+Version: 3.0.12
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -1958,7 +1969,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 3.0.11
|
|
|
|
|
|
|
+Version: 3.0.12
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -2421,7 +2432,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 3.0.11
|
|
|
|
|
|
|
+Version: 3.0.12
|
|
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
*/
|
|
@@ -2430,11 +2441,15 @@ Optional extensions on the jquery.inputmask base
|
|
|
$.extend($.inputmask.defaults.aliases, {
|
|
$.extend($.inputmask.defaults.aliases, {
|
|
|
'numeric': {
|
|
'numeric': {
|
|
|
mask: function (opts) {
|
|
mask: function (opts) {
|
|
|
|
|
+ if (opts.repeat !== 0 && isNaN(opts.integerDigits)) {
|
|
|
|
|
+ opts.integerDigits = opts.repeat;
|
|
|
|
|
+ }
|
|
|
|
|
+ opts.repeat = 0;
|
|
|
var mask = opts.prefix;
|
|
var mask = opts.prefix;
|
|
|
mask += "[+]";
|
|
mask += "[+]";
|
|
|
mask += "~{1," + opts.integerDigits + "}";
|
|
mask += "~{1," + opts.integerDigits + "}";
|
|
|
- if (parseInt(opts.digits) > 0)
|
|
|
|
|
- mask += "[" + opts.radixPoint + "~{" + opts.digits + "}]";
|
|
|
|
|
|
|
+ if (opts.digits != undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0))
|
|
|
|
|
+ mask += "[" + opts.radixPoint + "={" + opts.digits + "}]";
|
|
|
mask += opts.suffix;
|
|
mask += opts.suffix;
|
|
|
return mask;
|
|
return mask;
|
|
|
},
|
|
},
|
|
@@ -2523,6 +2538,29 @@ Optional extensions on the jquery.inputmask base
|
|
|
cardinality: 1,
|
|
cardinality: 1,
|
|
|
prevalidator: null
|
|
prevalidator: null
|
|
|
},
|
|
},
|
|
|
|
|
+ '=': {
|
|
|
|
|
+ validator: function (chrs, buffer, pos, strict, opts) {
|
|
|
|
|
+ if (!strict && chrs === "-") {
|
|
|
|
|
+ var matchRslt = buffer.join('').match(opts.regex.integerPart(opts));
|
|
|
|
|
+
|
|
|
|
|
+ if (matchRslt.length > 0) {
|
|
|
|
|
+ if (buffer[matchRslt.index] == "+") {
|
|
|
|
|
+ buffer.splice(matchRslt.index, 1);
|
|
|
|
|
+ return { "pos": matchRslt.index, "c": "-", "refreshFromBuffer": true, "caret": pos };
|
|
|
|
|
+ } else if (buffer[matchRslt.index] == "-") {
|
|
|
|
|
+ buffer.splice(matchRslt.index, 1);
|
|
|
|
|
+ return { "refreshFromBuffer": true, "caret": pos - 1 };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return { "pos": matchRslt.index, "c": "-", "caret": pos + 1 };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ var isValid = new RegExp("[0-9]").test(chrs);
|
|
|
|
|
+ return isValid;
|
|
|
|
|
+ },
|
|
|
|
|
+ cardinality: 1,
|
|
|
|
|
+ prevalidator: null
|
|
|
|
|
+ },
|
|
|
'+': {
|
|
'+': {
|
|
|
validator: function (chrs, buffer, pos, strict, opts) {
|
|
validator: function (chrs, buffer, pos, strict, opts) {
|
|
|
var signed = "[";
|
|
var signed = "[";
|
|
@@ -2553,7 +2591,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 3.0.11
|
|
|
|
|
|
|
+Version: 3.0.12
|
|
|
|
|
|
|
|
Regex extensions on the jquery.inputmask base
|
|
Regex extensions on the jquery.inputmask base
|
|
|
Allows for using regular expressions as a mask
|
|
Allows for using regular expressions as a mask
|
|
@@ -2740,7 +2778,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
Copyright (c) 2010 - 2014 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 3.0.11
|
|
|
|
|
|
|
+Version: 3.0.12
|
|
|
|
|
|
|
|
Phone extension.
|
|
Phone extension.
|
|
|
When using this extension make sure you specify the correct url to get the masks
|
|
When using this extension make sure you specify the correct url to get the masks
|