Browse Source

fix phone extensions

Robin Herbots 11 years ago
parent
commit
bdf02d7fd0

+ 43 - 6
README.md

@@ -46,10 +46,10 @@ Define your masks:
 
 ```javascript
 $(document).ready(function(){
-   $(selector).inputmask("99-9999999");  //direct mask
+   $(selector).inputmask("99-9999999");  //static mask
    $(selector).inputmask("mask", {"mask": "(999) 999-9999"}); //specifying fn & options
    $(selector).inputmask({"mask": "99-9999999"}); //specifying options only
-   $(selector).inputmask("9-a{1,3}9{1,3}"); //direct mask with dynamic syntax 
+   $(selector).inputmask("9-a{1,3}9{1,3}"); //mask with dynamic syntax 
 });
 ```
 
@@ -90,9 +90,17 @@ There are more definitions defined within the extensions.
 You can find info within the js-files or by further exploring the options.
 
 ## Masking types
-### Basic masks
+### Static masks
 
-TODO - explain
+These are the very basic of masking.  The mask is defined and will not change during the input.
+
+
+```javascript
+$(document).ready(function(){
+   $(selector).inputmask("aa-9999");  //static mask
+   $(selector).inputmask({mask: "aa-9999"});  //static mask
+});
+```
 
 ### Optional masks
 
@@ -139,7 +147,35 @@ The initial mask shown will be "_____" instead of "_____-____".
 
 ### Dynamic masks
 
-TODO - explain
+Dynamic masks can change during the input.  To define a dynamic part use { }.
+
+{n} => n repeats  
+{n,m} => from n to m repeats
+
+Also {+} and {*} is allowed. + start from 1 and * start from 0.
+
+```javascript
+$(document).ready(function(){
+   $(selector).inputmask("aa-9{4}");  //static mask with dynamic syntax
+   $(selector).inputmask("aa-9{1,4}");  //dynamic mask ~ the 9 def can be occur 1 to 4 times
+
+   //email mask	
+   $(selector).inputmask({
+            mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,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"
+                }
+            }
+	});
+```
 
 ### Alternator masks
 
@@ -492,7 +528,7 @@ $(document).ready(function(){
 #### nojumps: false, //do not jump over fixed parts in the mask
 #### nojumpsThreshold: 0, //start nojumps as of
 #### keepStatic
-Default: false 
+Default: undefined (~false)   
 Use in combination with the alternator syntax
 Try to keep the mask static while typing. Decisions to alter the mask will be posponed if possible.
 
@@ -502,6 +538,7 @@ $(selector).inputmask({ mask: ["+55-99-9999-9999", "+55-99-99999-9999", ], keepS
 typing 1212345123 => should result in +55-12-1234-5123 
 type extra 4 => switch to +55-12-12345-1234
 
+When passing multiple masks (an array of masks) keepStatic is automatically set to true unless explicitly set through the options.
 
 #### definitions
 #### ignorables

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.0.72",
+  "version": "3.0.73",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 3
 build.minor = 0
-build.revision = 72
+build.revision = 73
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

File diff suppressed because it is too large
+ 61 - 61
dist/inputmask/jquery.inputmask.js


File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/jquery.inputmask.phone.extensions.js


+ 62 - 59
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.0.72
+* Version: 3.0.73
 */
 
 (function (factory) {
@@ -263,7 +263,7 @@
                 opts.mask = opts.mask.call(this, opts);
             }
             if ($.isArray(opts.mask)) {
-                if (multi) {
+                if (multi) {  //remove me
                     $.each(opts.mask, function (ndx, msk) {
                         if (msk["mask"] != undefined) {
                             ms.push(generateMask(msk["mask"].toString(), msk));
@@ -272,6 +272,7 @@
                         }
                     });
                 } else {
+                    opts.keepStatic = opts.keepStatic == undefined ? true: opts.keepStatic; //enable by default when passing multiple masks when the option is not explicitly specified
                     var hasMetaData = false;
                     var altMask = "(";
                     $.each(opts.mask, function (ndx, msk) {
@@ -537,19 +538,20 @@
                                             if (isFinite(ndx)) {
                                                 var altLocArr = lmnt.locator[loopNdxCnt].toString().split(",");
                                                 var mamatch;
-                                                lmnt.locator[loopNdxCnt] = "";
+                                                lmnt.locator[loopNdxCnt] = undefined;
                                                 lmnt.alternation = undefined;
                                                 for (var alndx = 0; alndx < altLocArr.length; alndx++) {
                                                     mamatch = $.inArray(altLocArr[alndx], altIndexArr) != -1;
-                                                    if (mamatch) {
-                                                        if (lmnt.locator[loopNdxCnt] != "") {
+                                                    if (mamatch) { //rebuild the locator with valid entries
+                                                        if (lmnt.locator[loopNdxCnt] != undefined) {
                                                             lmnt.locator[loopNdxCnt] += ",";
                                                             lmnt.alternation = loopNdxCnt; //only define alternation when there is more then 1 possibility
-                                                        }
-                                                        lmnt.locator[loopNdxCnt] += altLocArr[alndx]; //rebuild the locator with valid entries
+                                                            lmnt.locator[loopNdxCnt] += altLocArr[alndx];
+                                                        } else
+                                                            lmnt.locator[loopNdxCnt] = parseInt(altLocArr[alndx]);
                                                     }
                                                 }
-                                                if (lmnt.locator[loopNdxCnt] != "") return lmnt;
+                                                if (lmnt.locator[loopNdxCnt] != undefined) return lmnt;
                                             }
                                         });
                                     }
@@ -758,57 +760,59 @@
                         var validPsClone = $.extend(true, {}, getMaskSet()["validPositions"]),
                             firstAlt,
                             alternation;
-                        //find first alternation
-                        for (firstAlt in getMaskSet()["validPositions"]) {
-                            if (getMaskSet()["validPositions"][firstAlt].alternation != undefined) {
+                        //find last alternation
+                        for (firstAlt = getLastValidPosition() ; firstAlt >= 0; firstAlt--) {
+                            if (getMaskSet()["validPositions"][firstAlt] && getMaskSet()["validPositions"][firstAlt].alternation != undefined) {
                                 alternation = getMaskSet()["validPositions"][firstAlt].alternation;
                                 break;
                             }
                         }
-                        //find first decision making position
-                        for (var decisionPos in getMaskSet()["validPositions"]) {
-                            if (parseInt(decisionPos) > parseInt(firstAlt) && getMaskSet()["validPositions"][decisionPos].alternation === undefined) {
-                                var altPos = getMaskSet()["validPositions"][decisionPos],
-                                    decisionTaker = altPos.locator[alternation],
-                                    altNdxs = getMaskSet()["validPositions"][firstAlt].locator[alternation].split(",");
-
-                                for (var mndx = 0; mndx < altNdxs.length; mndx++) {
-                                    if (decisionTaker < altNdxs[mndx]) {
-                                        var possibilityPos, possibilities;
-                                        for (var dp = decisionPos - 1; dp >= 0; dp--) {
-                                            possibilityPos = getMaskSet()["validPositions"][seekPrevious(decisionPos)];
-                                            if (possibilityPos != undefined) {
-                                                possibilities = possibilityPos.locator[alternation]; //store to reset 
-                                                possibilityPos.locator[alternation] = altNdxs[mndx];
-                                                break;
-                                            }
-                                        }
-                                        if (decisionTaker != possibilityPos.locator[alternation]) {
-                                            var buffer = getBuffer().slice(); //work on clone
-                                            for (var i = decisionPos; i < getLastValidPosition() + 1; i++) {
-                                                delete getMaskSet()["validPositions"][i];
-                                                delete getMaskSet()["tests"][i];
-                                            }
-                                            resetMaskSet(true); //clear getbuffer
-                                            opts.keepStatic = !opts.keepStatic; //disable keepStatic on getMaskLength
-                                            for (var i = decisionPos; i < buffer.length; i++) {
-                                                if (buffer[i] != opts.skipOptionalPartCharacter) {
-                                                    isValid(getLastValidPosition() + 1, buffer[i], false, true);
+                        if (alternation != undefined) {
+                            //find first decision making position
+                            for (var decisionPos in getMaskSet()["validPositions"]) {
+                                if (parseInt(decisionPos) > parseInt(firstAlt) && getMaskSet()["validPositions"][decisionPos].alternation === undefined) {
+                                    var altPos = getMaskSet()["validPositions"][decisionPos],
+                                        decisionTaker = altPos.locator[alternation],
+                                        altNdxs = getMaskSet()["validPositions"][firstAlt].locator[alternation].split(",");
+
+                                    for (var mndx = 0; mndx < altNdxs.length; mndx++) {
+                                        if (decisionTaker < altNdxs[mndx]) {
+                                            var possibilityPos, possibilities;
+                                            for (var dp = decisionPos - 1; dp >= 0; dp--) {
+                                                possibilityPos = getMaskSet()["validPositions"][dp];
+                                                if (possibilityPos != undefined) {
+                                                    possibilities = possibilityPos.locator[alternation]; //store to reset 
+                                                    possibilityPos.locator[alternation] = altNdxs[mndx];
+                                                    break;
                                                 }
                                             }
-                                            possibilityPos.locator[alternation] = possibilities; //reset forceddecision ~ needed for proper delete
-
-                                            var isValidRslt = isValid(pos, c, strict, fromSetValid);
-                                            opts.keepStatic = !opts.keepStatic; //enable keepStatic on getMaskLength
-                                            if (!isValidRslt) {
-                                                resetMaskSet();
-                                                getMaskSet()["validPositions"] = $.extend(true, {}, validPsClone);
+                                            if (decisionTaker != possibilityPos.locator[alternation]) {
+                                                var buffer = getBuffer().slice(); //work on clone
+                                                for (var i = decisionPos; i < getLastValidPosition() + 1; i++) {
+                                                    delete getMaskSet()["validPositions"][i];
+                                                    delete getMaskSet()["tests"][i];
+                                                }
+                                                resetMaskSet(true); //clear getbuffer
+                                                opts.keepStatic = !opts.keepStatic; //disable keepStatic on getMaskLength
+                                                for (var i = decisionPos; i < buffer.length; i++) {
+                                                    if (buffer[i] != opts.skipOptionalPartCharacter) {
+                                                        isValid(getLastValidPosition() + 1, buffer[i], false, true);
+                                                    }
+                                                }
+                                                possibilityPos.locator[alternation] = possibilities; //reset forceddecision ~ needed for proper delete
+
+                                                var isValidRslt = isValid(pos, c, strict, fromSetValid);
+                                                opts.keepStatic = !opts.keepStatic; //enable keepStatic on getMaskLength
+                                                if (!isValidRslt) {
+                                                    resetMaskSet();
+                                                    getMaskSet()["validPositions"] = $.extend(true, {}, validPsClone);
+                                                } else
+                                                    return isValidRslt;
                                             }
-                                            return isValidRslt;
                                         }
                                     }
+                                    break;
                                 }
-                                break;
                             }
                         }
                     }
@@ -1473,7 +1477,6 @@
                     var forwardPosition = getMaskSet()["p"];
                     writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
                 }, 0);
-                skipInputEvent === true
                 return false;
             }
             function mask(el) {
@@ -1600,7 +1603,7 @@
                     }).bind(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", pasteEvent
                     ).bind('setvalue.inputmask', function () {
                         var input = this;
-                        checkVal(input, true);
+                        checkVal(input, true, false, undefined, true);
                         valueOnFocus = getBuffer().join('');
                     }).bind('complete.inputmask', opts.oncomplete
                     ).bind('incomplete.inputmask', opts.onincomplete
@@ -1794,7 +1797,7 @@
                 //numeric basic properties
                 nojumps: false, //do not jump over fixed parts in the mask
                 nojumpsThreshold: 0, //start nojumps as of
-                keepStatic: false, //try to keep the mask static while typing. Decisions to alter the mask will be posponed if possible
+                keepStatic: undefined, //try to keep the mask static while typing. Decisions to alter the mask will be posponed if possible - undefined see auto selection for multi masks
                 definitions: {
                     '9': {
                         validator: "[0-9]",
@@ -1949,7 +1952,7 @@ 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: 3.0.72
+Version: 3.0.73
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2077,7 +2080,7 @@ 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: 3.0.72
+Version: 3.0.73
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2573,7 +2576,7 @@ 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: 3.0.72
+Version: 3.0.73
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2833,7 +2836,7 @@ 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: 3.0.72
+Version: 3.0.73
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
@@ -3027,7 +3030,7 @@ 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: 3.0.72
+Version: 3.0.73
 
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks
@@ -3072,7 +3075,7 @@ When using this extension make sure you specify the correct url to get the masks
                     }
                 });
 
-                maskList.splice(0, 0, "+p(ppp)ppp-pppp");
+                maskList.splice(0, 0, "+pp-pppppppppp");
                 return maskList;
             },
             nojumps: true,
@@ -3101,7 +3104,7 @@ When using this extension make sure you specify the correct url to get the masks
                     }
                 });
 
-                maskList.splice(0, 0, "+32(ppp)ppp-pppp");
+                maskList.splice(0, 0, "+32-pppppppppp");
                 return maskList;
             },
             nojumps: true,

File diff suppressed because it is too large
+ 74 - 74
dist/jquery.inputmask.bundle.min.js


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "3.0.72",
+    "version": "3.0.73",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 54 - 51
js/jquery.inputmask.js

@@ -263,7 +263,7 @@
                 opts.mask = opts.mask.call(this, opts);
             }
             if ($.isArray(opts.mask)) {
-                if (multi) {
+                if (multi) {  //remove me
                     $.each(opts.mask, function (ndx, msk) {
                         if (msk["mask"] != undefined) {
                             ms.push(generateMask(msk["mask"].toString(), msk));
@@ -272,6 +272,7 @@
                         }
                     });
                 } else {
+                    opts.keepStatic = opts.keepStatic == undefined ? true: opts.keepStatic; //enable by default when passing multiple masks when the option is not explicitly specified
                     var hasMetaData = false;
                     var altMask = "(";
                     $.each(opts.mask, function (ndx, msk) {
@@ -537,19 +538,20 @@
                                             if (isFinite(ndx)) {
                                                 var altLocArr = lmnt.locator[loopNdxCnt].toString().split(",");
                                                 var mamatch;
-                                                lmnt.locator[loopNdxCnt] = "";
+                                                lmnt.locator[loopNdxCnt] = undefined;
                                                 lmnt.alternation = undefined;
                                                 for (var alndx = 0; alndx < altLocArr.length; alndx++) {
                                                     mamatch = $.inArray(altLocArr[alndx], altIndexArr) != -1;
-                                                    if (mamatch) {
-                                                        if (lmnt.locator[loopNdxCnt] != "") {
+                                                    if (mamatch) { //rebuild the locator with valid entries
+                                                        if (lmnt.locator[loopNdxCnt] != undefined) {
                                                             lmnt.locator[loopNdxCnt] += ",";
                                                             lmnt.alternation = loopNdxCnt; //only define alternation when there is more then 1 possibility
-                                                        }
-                                                        lmnt.locator[loopNdxCnt] += altLocArr[alndx]; //rebuild the locator with valid entries
+                                                            lmnt.locator[loopNdxCnt] += altLocArr[alndx];
+                                                        } else
+                                                            lmnt.locator[loopNdxCnt] = parseInt(altLocArr[alndx]);
                                                     }
                                                 }
-                                                if (lmnt.locator[loopNdxCnt] != "") return lmnt;
+                                                if (lmnt.locator[loopNdxCnt] != undefined) return lmnt;
                                             }
                                         });
                                     }
@@ -758,57 +760,59 @@
                         var validPsClone = $.extend(true, {}, getMaskSet()["validPositions"]),
                             firstAlt,
                             alternation;
-                        //find first alternation
-                        for (firstAlt in getMaskSet()["validPositions"]) {
-                            if (getMaskSet()["validPositions"][firstAlt].alternation != undefined) {
+                        //find last alternation
+                        for (firstAlt = getLastValidPosition() ; firstAlt >= 0; firstAlt--) {
+                            if (getMaskSet()["validPositions"][firstAlt] && getMaskSet()["validPositions"][firstAlt].alternation != undefined) {
                                 alternation = getMaskSet()["validPositions"][firstAlt].alternation;
                                 break;
                             }
                         }
-                        //find first decision making position
-                        for (var decisionPos in getMaskSet()["validPositions"]) {
-                            if (parseInt(decisionPos) > parseInt(firstAlt) && getMaskSet()["validPositions"][decisionPos].alternation === undefined) {
-                                var altPos = getMaskSet()["validPositions"][decisionPos],
-                                    decisionTaker = altPos.locator[alternation],
-                                    altNdxs = getMaskSet()["validPositions"][firstAlt].locator[alternation].split(",");
-
-                                for (var mndx = 0; mndx < altNdxs.length; mndx++) {
-                                    if (decisionTaker < altNdxs[mndx]) {
-                                        var possibilityPos, possibilities;
-                                        for (var dp = decisionPos - 1; dp >= 0; dp--) {
-                                            possibilityPos = getMaskSet()["validPositions"][seekPrevious(decisionPos)];
-                                            if (possibilityPos != undefined) {
-                                                possibilities = possibilityPos.locator[alternation]; //store to reset 
-                                                possibilityPos.locator[alternation] = altNdxs[mndx];
-                                                break;
-                                            }
-                                        }
-                                        if (decisionTaker != possibilityPos.locator[alternation]) {
-                                            var buffer = getBuffer().slice(); //work on clone
-                                            for (var i = decisionPos; i < getLastValidPosition() + 1; i++) {
-                                                delete getMaskSet()["validPositions"][i];
-                                                delete getMaskSet()["tests"][i];
-                                            }
-                                            resetMaskSet(true); //clear getbuffer
-                                            opts.keepStatic = !opts.keepStatic; //disable keepStatic on getMaskLength
-                                            for (var i = decisionPos; i < buffer.length; i++) {
-                                                if (buffer[i] != opts.skipOptionalPartCharacter) {
-                                                    isValid(getLastValidPosition() + 1, buffer[i], false, true);
+                        if (alternation != undefined) {
+                            //find first decision making position
+                            for (var decisionPos in getMaskSet()["validPositions"]) {
+                                if (parseInt(decisionPos) > parseInt(firstAlt) && getMaskSet()["validPositions"][decisionPos].alternation === undefined) {
+                                    var altPos = getMaskSet()["validPositions"][decisionPos],
+                                        decisionTaker = altPos.locator[alternation],
+                                        altNdxs = getMaskSet()["validPositions"][firstAlt].locator[alternation].split(",");
+
+                                    for (var mndx = 0; mndx < altNdxs.length; mndx++) {
+                                        if (decisionTaker < altNdxs[mndx]) {
+                                            var possibilityPos, possibilities;
+                                            for (var dp = decisionPos - 1; dp >= 0; dp--) {
+                                                possibilityPos = getMaskSet()["validPositions"][dp];
+                                                if (possibilityPos != undefined) {
+                                                    possibilities = possibilityPos.locator[alternation]; //store to reset 
+                                                    possibilityPos.locator[alternation] = altNdxs[mndx];
+                                                    break;
                                                 }
                                             }
-                                            possibilityPos.locator[alternation] = possibilities; //reset forceddecision ~ needed for proper delete
-
-                                            var isValidRslt = isValid(pos, c, strict, fromSetValid);
-                                            opts.keepStatic = !opts.keepStatic; //enable keepStatic on getMaskLength
-                                            if (!isValidRslt) {
-                                                resetMaskSet();
-                                                getMaskSet()["validPositions"] = $.extend(true, {}, validPsClone);
+                                            if (decisionTaker != possibilityPos.locator[alternation]) {
+                                                var buffer = getBuffer().slice(); //work on clone
+                                                for (var i = decisionPos; i < getLastValidPosition() + 1; i++) {
+                                                    delete getMaskSet()["validPositions"][i];
+                                                    delete getMaskSet()["tests"][i];
+                                                }
+                                                resetMaskSet(true); //clear getbuffer
+                                                opts.keepStatic = !opts.keepStatic; //disable keepStatic on getMaskLength
+                                                for (var i = decisionPos; i < buffer.length; i++) {
+                                                    if (buffer[i] != opts.skipOptionalPartCharacter) {
+                                                        isValid(getLastValidPosition() + 1, buffer[i], false, true);
+                                                    }
+                                                }
+                                                possibilityPos.locator[alternation] = possibilities; //reset forceddecision ~ needed for proper delete
+
+                                                var isValidRslt = isValid(pos, c, strict, fromSetValid);
+                                                opts.keepStatic = !opts.keepStatic; //enable keepStatic on getMaskLength
+                                                if (!isValidRslt) {
+                                                    resetMaskSet();
+                                                    getMaskSet()["validPositions"] = $.extend(true, {}, validPsClone);
+                                                } else
+                                                    return isValidRslt;
                                             }
-                                            return isValidRslt;
                                         }
                                     }
+                                    break;
                                 }
-                                break;
                             }
                         }
                     }
@@ -1473,7 +1477,6 @@
                     var forwardPosition = getMaskSet()["p"];
                     writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
                 }, 0);
-                skipInputEvent === true
                 return false;
             }
             function mask(el) {
@@ -1600,7 +1603,7 @@
                     }).bind(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", pasteEvent
                     ).bind('setvalue.inputmask', function () {
                         var input = this;
-                        checkVal(input, true);
+                        checkVal(input, true, false, undefined, true);
                         valueOnFocus = getBuffer().join('');
                     }).bind('complete.inputmask', opts.oncomplete
                     ).bind('incomplete.inputmask', opts.onincomplete
@@ -1794,7 +1797,7 @@
                 //numeric basic properties
                 nojumps: false, //do not jump over fixed parts in the mask
                 nojumpsThreshold: 0, //start nojumps as of
-                keepStatic: false, //try to keep the mask static while typing. Decisions to alter the mask will be posponed if possible
+                keepStatic: undefined, //try to keep the mask static while typing. Decisions to alter the mask will be posponed if possible - undefined see auto selection for multi masks
                 definitions: {
                     '9': {
                         validator: "[0-9]",

+ 2 - 2
js/jquery.inputmask.phone.extensions.js

@@ -48,7 +48,7 @@ When using this extension make sure you specify the correct url to get the masks
                     }
                 });
 
-                maskList.splice(0, 0, "+p(ppp)ppp-pppp");
+                maskList.splice(0, 0, "+pp-pppppppppp");
                 return maskList;
             },
             nojumps: true,
@@ -77,7 +77,7 @@ When using this extension make sure you specify the correct url to get the masks
                     }
                 });
 
-                maskList.splice(0, 0, "+32(ppp)ppp-pppp");
+                maskList.splice(0, 0, "+32-pppppppppp");
                 return maskList;
             },
             nojumps: true,

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.0.72",
+  "version": "3.0.73",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",

+ 56 - 0
qunit/tests_base.js

@@ -599,6 +599,62 @@ asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"0079114041112\" - monobla
 
 });
 
+asyncTest("inputmask(\"+32(999)99-99-99\", { nojumps: true, nojumpsThreshold: 4 }) ~ paste \"+32(123)12-12-12\"", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("+32(999)99-99-99", { nojumps: true, nojumpsThreshold: 4 });
+    $("#testmask")[0].focus();
+    $("#testmask").paste("+32(123)12-12-12");
+
+    setTimeout(function () {
+        equal($("#testmask").val(), "+32(123)12-12-12", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
+});
+
+asyncTest("inputmask(\"+32(999)99-99-99\", { nojumps: true, nojumpsThreshold: 4 }) ~ paste \"32(123)12-12-12\"", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("+32(999)99-99-99", { nojumps: true, nojumpsThreshold: 4 });
+    $("#testmask")[0].focus();
+    $("#testmask").paste("32(123)12-12-12");
+
+    setTimeout(function () {
+        equal($("#testmask").val(), "+32(123)12-12-12", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
+});
+
+asyncTest("inputmask(\"+32(999)99-99-99\", { nojumps: true, nojumpsThreshold: 4 }) ~ paste \"(123)12-12-12\"", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("+32(999)99-99-99", { nojumps: true, nojumpsThreshold: 4 });
+    $("#testmask")[0].focus();
+    $("#testmask").paste("(123)12-12-12");
+
+    setTimeout(function () {
+        equal($("#testmask").val(), "+32(123)12-12-12", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
+});
+
+asyncTest("inputmask(\"+32(999)99-99-99\", { nojumps: true, nojumpsThreshold: 4 }) ~ paste \"32473890428\"", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("+32(999)99-99-99", { nojumps: true, nojumpsThreshold: 4 });
+    $("#testmask")[0].focus();
+    $("#testmask").paste("32473890428");
+
+    setTimeout(function () {
+        equal($("#testmask").val(), "+32(473)89-04-28", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
+});
+
 module("Set value with fn.val");
 test("inputmask(\"decimal\") ~ value=\"123.45\"", function () {
     var $fixture = $("#qunit-fixture");

+ 25 - 0
qunit/tests_keepStatic.js

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

+ 3 - 3
qunit/tests_multi.js

@@ -133,10 +133,10 @@ asyncTest("inputmask({ mask: [\"99999\", \"99999-9999\", \"999999-9999\"]]}) - i
         $("#testmask").remove();
     }, 0);
 });
-asyncTest("inputmask({ mask: [\"99999\", \"99999-9999\", \"999999-9999\"]]}) - input 123456", function () {
+asyncTest("inputmask({ mask: [\"99999\", \"99999-9999\", \"999999-9999\"], keepStatic: false}) - input 123456", function () {
     var $fixture = $("#qunit-fixture");
     $fixture.append('<input type="text" id="testmask" />');
-    $("#testmask").inputmask({ mask: ["99999", "99999-9999", "999999-9999"] });
+    $("#testmask").inputmask({ mask: ["99999", "99999-9999", "999999-9999"], keepStatic: false });
 
     $("#testmask")[0].focus();
     $("#testmask").Type("123456");
@@ -171,7 +171,7 @@ asyncTest("inputmask({ mask: [\"99999\", \"99999-9999\", \"999999-9999\"]]}) - i
         $("#testmask").Type("123456");
         setTimeout(function () {
             start();
-            equal($("#testmask").val(), "____-654321", "Result " + $("#testmask").val());
+            equal($("#testmask").val(), "___6-54321", "Result " + $("#testmask").val());
             $("#testmask").remove();
         }, 0);
     }, 0);