Browse Source

Merge branch '1.x' into 2.x

Robin Herbots 12 years ago
parent
commit
24a4c68fcf

+ 1 - 1
build.properties

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

+ 17 - 12
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.1.15
+* Version: 2.1.16
 */
 
 (function ($) {
@@ -649,7 +649,8 @@
                     return input._valueGet();
                 }
             }
-
+		
+	    	var caretSavePoint;
             function caret(input, begin, end) {
                 var npt = input.jquery && input.length > 0 ? input[0] : input, rabge;
                 if (typeof begin == 'number') {
@@ -659,11 +660,13 @@
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
-                        if (android)
+                        if (android) {
                             setTimeout(function () {
                                 npt.selectionStart = begin;
-                                npt.selectionEnd = end;
-                            }, 0);
+                                npt.selectionEnd = android ? begin : end;
+                            }, 10);
+			    			caretSavePoint = { "begin": begin, "end": end };	
+						}
                         else {
                             npt.selectionStart = begin;
                             npt.selectionEnd = end;
@@ -677,7 +680,7 @@
                     }
                 } else {
                     if (!$(input).is(':visible')) {
-                        return { begin: 0, end: 0 };
+                        return { "begin": 0, "end": 0 };
                     }
                     if (npt.setSelectionRange) {
                         begin = npt.selectionStart;
@@ -687,7 +690,7 @@
                         begin = 0 - range.duplicate().moveStart('character', -100000);
                         end = begin + range.text.length;
                     }
-                    return { begin: begin, end: end };
+                    return { "begin": begin, "end": end };
                 }
             };
 
@@ -1045,7 +1048,6 @@
                     skipKeyPressEvent = false;
 
                     var input = this, k = e.keyCode, pos = caret(input);
-
                     determineInputDirection(input, pos);
 
                     //backspace, delete, and escape get special treatment
@@ -1159,7 +1161,7 @@
                         return true;
                     } else {
                         if (k) {
-                            $input.trigger('input');
+                            //$input.trigger('input');
 
                             var pos = caret(input), maskL = getMaskLength(buffer), writeOutBuffer = true;
                             clearBuffer(buffer, pos.begin, pos.end);
@@ -1236,6 +1238,9 @@
                                     }
                                 }
                             }
+                            if(android) {
+                   		caret(input, caretSavePoint.begin, caretSavePoint.end);
+                  			}
                             e.preventDefault();
                         }
                     }
@@ -1263,7 +1268,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.15
+Version: 2.1.16
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1360,7 +1365,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.15
+Version: 2.1.16
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1853,7 +1858,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.15
+Version: 2.1.16
 
 Optional extensions on the jquery.inputmask base
 */

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 13 - 8
js/jquery.inputmask.js

@@ -649,7 +649,8 @@
                     return input._valueGet();
                 }
             }
-
+		
+	    	var caretSavePoint;
             function caret(input, begin, end) {
                 var npt = input.jquery && input.length > 0 ? input[0] : input, rabge;
                 if (typeof begin == 'number') {
@@ -659,11 +660,13 @@
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
-                        if (android)
+                        if (android) {
                             setTimeout(function () {
                                 npt.selectionStart = begin;
-                                npt.selectionEnd = end;
-                            }, 0);
+                                npt.selectionEnd = android ? begin : end;
+                            }, 10);
+			    			caretSavePoint = { "begin": begin, "end": end };	
+						}
                         else {
                             npt.selectionStart = begin;
                             npt.selectionEnd = end;
@@ -677,7 +680,7 @@
                     }
                 } else {
                     if (!$(input).is(':visible')) {
-                        return { begin: 0, end: 0 };
+                        return { "begin": 0, "end": 0 };
                     }
                     if (npt.setSelectionRange) {
                         begin = npt.selectionStart;
@@ -687,7 +690,7 @@
                         begin = 0 - range.duplicate().moveStart('character', -100000);
                         end = begin + range.text.length;
                     }
-                    return { begin: begin, end: end };
+                    return { "begin": begin, "end": end };
                 }
             };
 
@@ -1045,7 +1048,6 @@
                     skipKeyPressEvent = false;
 
                     var input = this, k = e.keyCode, pos = caret(input);
-
                     determineInputDirection(input, pos);
 
                     //backspace, delete, and escape get special treatment
@@ -1159,7 +1161,7 @@
                         return true;
                     } else {
                         if (k) {
-                            $input.trigger('input');
+                            //$input.trigger('input');
 
                             var pos = caret(input), maskL = getMaskLength(buffer), writeOutBuffer = true;
                             clearBuffer(buffer, pos.begin, pos.end);
@@ -1236,6 +1238,9 @@
                                     }
                                 }
                             }
+                            if(android) {
+                   		caret(input, caretSavePoint.begin, caretSavePoint.end);
+                  			}
                             e.preventDefault();
                         }
                     }

File diff suppressed because it is too large
+ 1269 - 0
js/jquery.inputmask.js~