Robin Herbots 12 years ago
parent
commit
b6c5c968b3

+ 1 - 1
build.properties

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

+ 1 - 1
component.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "jquery.inputmask",
     "name": "jquery.inputmask",
-    "version": "2.4.3",
+    "version": "2.4.4",
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
     "dependencies": {
     "dependencies": {
         "jquery": ">=1.7"
         "jquery": ">=1.7"

BIN
dist/jQuery.InputMask.2.4.3.nupkg


BIN
dist/jQuery.InputMask.2.4.4.nupkg


+ 38 - 24
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Copyright (c) 2010 - 2013 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: 2.4.3
+* Version: 2.4.4
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -84,17 +84,11 @@
                 msie10 = navigator.userAgent.match(new RegExp("msie 10", "i")) !== null,
                 msie10 = navigator.userAgent.match(new RegExp("msie 10", "i")) !== null,
                 iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
                 iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
                 android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
                 android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
+                androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null,
                 pasteEvent = isInputEventSupported('paste') && !msie10 ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange",
                 pasteEvent = isInputEventSupported('paste') && !msie10 ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange",
-                android53x,
                 masksets,
                 masksets,
                 activeMasksetIndex = 0;
                 activeMasksetIndex = 0;
 
 
-            if (android) {
-                var browser = navigator.userAgent.match(/safari.*/i),
-                    version = parseInt(new RegExp(/[0-9]+/).exec(browser));
-                android53x = (version <= 537);
-                //android534 = (533 < version) && (version <= 534);
-            }
             if (typeof fn === "string") {
             if (typeof fn === "string") {
                 switch (fn) {
                 switch (fn) {
                     case "mask":
                     case "mask":
@@ -924,7 +918,8 @@
                 this.isComplete = function (buffer) {
                 this.isComplete = function (buffer) {
                     return isComplete(buffer);
                     return isComplete(buffer);
                 };
                 };
-                function isComplete(buffer) {
+                function isComplete(buffer) { //return true / false / undefined (repeat *)
+                    if (opts.repeat == "*") return undefined;
                     var complete = false, highestValidPosition = 0, currentActiveMasksetIndex = activeMasksetIndex;
                     var complete = false, highestValidPosition = 0, currentActiveMasksetIndex = activeMasksetIndex;
                     $.each(masksets, function (ndx, ms) {
                     $.each(masksets, function (ndx, ms) {
                         if (typeof (ms) == "object") {
                         if (typeof (ms) == "object") {
@@ -1049,7 +1044,7 @@
                                 clearOptionalTail(input);
                                 clearOptionalTail(input);
                             }
                             }
                         }
                         }
-                        if (!isComplete(buffer)) {
+                        if (isComplete(buffer) === false) {
                             $input.trigger("incomplete");
                             $input.trigger("incomplete");
                             if (opts.clearIncomplete) {
                             if (opts.clearIncomplete) {
                                 $.each(masksets, function (ndx, ms) {
                                 $.each(masksets, function (ndx, ms) {
@@ -1115,10 +1110,7 @@
                         setTimeout(function () {
                         setTimeout(function () {
                             caret(input, 0, seekNext(getActiveMaskSet()["lastValidPosition"]));
                             caret(input, 0, seekNext(getActiveMaskSet()["lastValidPosition"]));
                         }, 0);
                         }, 0);
-                    }).bind("keydown.inputmask", keydownEvent
-                    ).bind("keypress.inputmask", keypressEvent
-                    ).bind("keyup.inputmask", keyupEvent
-                    ).bind(pasteEvent + ".inputmask dragdrop.inputmask drop.inputmask", function (e) {
+                    }).bind(pasteEvent + ".inputmask dragdrop.inputmask drop.inputmask", function (e) {
                         var input = this, $input = $(input);
                         var input = this, $input = $(input);
 
 
                         //paste event for IE8 and lower I guess ;-)
                         //paste event for IE8 and lower I guess ;-)
@@ -1127,7 +1119,7 @@
                         }
                         }
                         setTimeout(function () {
                         setTimeout(function () {
                             checkVal(input, true, false);
                             checkVal(input, true, false);
-                            if (isComplete(getActiveBuffer()))
+                            if (isComplete(getActiveBuffer()) === true)
                                 $input.trigger("complete");
                                 $input.trigger("complete");
                             $input.click();
                             $input.click();
                         }, 0);
                         }, 0);
@@ -1138,9 +1130,26 @@
                         if (input._valueGet() == getActiveBufferTemplate().join(''))
                         if (input._valueGet() == getActiveBufferTemplate().join(''))
                             input._valueSet('');
                             input._valueSet('');
                     }).bind("_keypress.inputmask", keypressEvent //will be skipped be the eventruler
                     }).bind("_keypress.inputmask", keypressEvent //will be skipped be the eventruler
-                    ).bind('complete.inputmask', opts.oncomplete)
-                        .bind('incomplete.inputmask', opts.onincomplete)
-                        .bind('cleared.inputmask', opts.oncleared);
+                    ).bind('complete.inputmask', opts.oncomplete
+                    ).bind('incomplete.inputmask', opts.onincomplete
+                    ).bind('cleared.inputmask', opts.oncleared
+                    ).bind("keyup.inputmask", keyupEvent);
+
+                    if (androidchrome) {
+                        $el.bind("input.inputmask", function (e) {
+                            var input = this, $input = $(input);
+
+                            setTimeout(function () {
+                                checkVal(input, true, false);
+                                if (isComplete(getActiveBuffer()) === true)
+                                    $input.trigger("complete");
+                                $input.click();
+                            }, 0);
+                        });
+                    } else {
+                        $el.bind("keydown.inputmask", keydownEvent
+                        ).bind("keypress.inputmask", keypressEvent);
+                    }
 
 
                     //apply mask
                     //apply mask
                     checkVal(el, true, false);
                     checkVal(el, true, false);
@@ -1601,7 +1610,7 @@
                                             writeBuffer(input, buffer, newCaretPosition);
                                             writeBuffer(input, buffer, newCaretPosition);
                                             if (checkval !== true) {
                                             if (checkval !== true) {
                                                 setTimeout(function () { //timeout needed for IE
                                                 setTimeout(function () { //timeout needed for IE
-                                                    if (isComplete(buffer))
+                                                    if (isComplete(buffer) === true)
                                                         $input.trigger("complete");
                                                         $input.trigger("complete");
                                                 }, 0);
                                                 }, 0);
                                             }
                                             }
@@ -1621,6 +1630,11 @@
 
 
                     function keyupEvent(e) {
                     function keyupEvent(e) {
                         var $input = $(this), input = this, k = e.keyCode, buffer = getActiveBuffer();
                         var $input = $(this), input = this, k = e.keyCode, buffer = getActiveBuffer();
+
+                        if (androidchrome && k == opts.keyCode.BACKSPACE) {
+                            keydownEvent.call(this, e);
+                        }
+
                         opts.onKeyUp.call(this, e, buffer, opts); //extra stuff to execute on keyup
                         opts.onKeyUp.call(this, e, buffer, opts); //extra stuff to execute on keyup
                         if (k == opts.keyCode.TAB && opts.showMaskOnFocus) {
                         if (k == opts.keyCode.TAB && opts.showMaskOnFocus) {
                             if ($input.hasClass('focus.inputmask') && input._valueGet().length == 0) {
                             if ($input.hasClass('focus.inputmask') && input._valueGet().length == 0) {
@@ -1646,7 +1660,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 2.4.3
+Version: 2.4.4
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1768,7 +1782,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 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: 2.4.3
+Version: 2.4.4
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2252,7 +2266,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 2.4.3
+Version: 2.4.4
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2429,7 +2443,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 2.4.3
+Version: 2.4.4
 
 
 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
@@ -2599,7 +2613,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 2.4.3
+Version: 2.4.4
 
 
 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

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 2 - 2
js/jquery.inputmask.js

@@ -1147,8 +1147,8 @@
                             }, 0);
                             }, 0);
                         });
                         });
                     } else {
                     } else {
-                        $el.bind("keydown.inputmask", keypressEvent
-                        ).bind("keypress.inputmask", keydownEvent);
+                        $el.bind("keydown.inputmask", keydownEvent
+                        ).bind("keypress.inputmask", keypressEvent);
                     }
                     }
 
 
                     //apply mask
                     //apply mask