Robin Herbots 12 年 前
コミット
e15dc1fa63

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "jquery.inputmask",
-    "version": "2.4.22",
+    "version": "2.4.24",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.",

+ 1 - 1
build.properties

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

BIN
dist/jQuery.InputMask.2.4.22.nupkg


BIN
dist/jQuery.InputMask.2.4.24.nupkg


+ 17 - 11
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: 2.4.22
+* Version: 2.4.24
 */
 
 (function ($) {
@@ -224,17 +224,21 @@
             return opts.greedy ? ms : ms.sort(function (a, b) { return a["mask"].length - b["mask"].length; });
         }
 
-        var msie1x = new Function("/*@cc_on return @_jscript_version; @*/")() >= 10, //conditional compilation from mickeysoft trick
+        var msie1x = typeof ScriptEngineMajorVersion === "function"
+                        ? ScriptEngineMajorVersion() //IE11 detection
+                        : new Function("/*@cc_on return @_jscript_version; @*/")() >= 10, //conditional compilation from mickeysoft trick
             iphone = navigator.userAgent.match(new RegExp("iphone", "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') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange",
-            androidchrome32 = false;
+            androidchrome32 = false, androidchrome18 = false, androidchrome29 = false;
 
         if (androidchrome) {
             var browser = navigator.userAgent.match(new RegExp("chrome.*", "i")),
                 version = parseInt(new RegExp(/[0-9]+/).exec(browser));
             androidchrome32 = (version == 32);
+            androidchrome18 = (version == 18);
+            androidchrome29 = (version == 29);
         }
 
         //masking scope
@@ -1384,7 +1388,7 @@
                          ).bind("keypress.inputmask", keypressEvent
                          ).bind("keyup.inputmask", keyupEvent);
 
-                    if (androidchrome32) {
+                    if (androidchrome32 || androidchrome18 || androidchrome29) {
                         $el.bind("input.inputmask", chrome32InputEvent);
                     }    
                     if (msie1x)
@@ -1484,11 +1488,13 @@
                 definitions: {
                     '9': {
                         validator: "[0-9]",
-                        cardinality: 1
+                        cardinality: 1,
+                        definitionSymbol: "*"
                     },
                     'a': {
                         validator: "[A-Za-z\u0410-\u044F\u0401\u0451]",
-                        cardinality: 1
+                        cardinality: 1,
+                        definitionSymbol: "*"
                     },
                     '*': {
                         validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]",
@@ -1660,7 +1666,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: 2.4.22
+Version: 2.4.24
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1782,7 +1788,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: 2.4.22
+Version: 2.4.24
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2270,7 +2276,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: 2.4.22
+Version: 2.4.24
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2447,7 +2453,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: 2.4.22
+Version: 2.4.24
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
@@ -2617,7 +2623,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: 2.4.22
+Version: 2.4.24
 
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks

ファイルの差分が大きいため隠しています
+ 66 - 66
dist/jquery.inputmask.bundle.min.js


ファイルの差分が大きいため隠しています
+ 50 - 50
dist/min/jquery.inputmask.js


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 4 - 2
js/jquery.inputmask.js

@@ -1488,11 +1488,13 @@
                 definitions: {
                     '9': {
                         validator: "[0-9]",
-                        cardinality: 1
+                        cardinality: 1,
+                        definitionSymbol: "*"
                     },
                     'a': {
                         validator: "[A-Za-z\u0410-\u044F\u0401\u0451]",
-                        cardinality: 1
+                        cardinality: 1,
+                        definitionSymbol: "*"
                     },
                     '*': {
                         validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]",

+ 1 - 0
qunit/qunit.html

@@ -12,6 +12,7 @@
   <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
   <script src="http://code.jquery.com/qunit/qunit-1.12.0.js"></script>
   <script src="../dist/jquery.inputmask.bundle.js"></script>
+  <script src="./simulator.js"></script>
   <script src="./tests.js"></script>
 </body>
 </html>

+ 97 - 0
qunit/simulator.js

@@ -0,0 +1,97 @@
+var 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
+}
+function caret(input, begin, end) {
+    var npt = input.jquery && input.length > 0 ? input[0] : input, range;
+    if (typeof begin == 'number') {
+        if (!$(input).is(':visible')) {
+            return;
+        }
+        end = (typeof end == 'number') ? end : begin;
+        if (npt.setSelectionRange) {
+            npt.selectionStart = begin;
+            npt.selectionEnd = end;
+
+        } else if (npt.createTextRange) {
+            range = npt.createTextRange();
+            range.collapse(true);
+            range.moveEnd('character', end);
+            range.moveStart('character', begin);
+            range.select();
+        }
+    } else {
+        if (!$(input).is(':visible')) {
+            return { "begin": 0, "end": 0 };
+        }
+        if (npt.setSelectionRange) {
+            begin = npt.selectionStart;
+            end = npt.selectionEnd;
+        } else if (document.selection && document.selection.createRange) {
+            range = document.selection.createRange();
+            begin = 0 - range.duplicate().moveStart('character', -100000);
+            end = begin + range.text.length;
+        }
+        return { "begin": begin, "end": end };
+    }
+};
+$.fn.SendKey = function (keyCode, modifier) {
+    var sendDummyKeydown = false;
+    if (Object.prototype.toString.call(keyCode) == '[object String]') {
+        keyCode = keyCode.charCodeAt(0);
+        sendDummyKeydown = true;
+    }
+
+    switch (keyCode) {
+        case keyCodes.LEFT: {
+            if (modifier == undefined) {
+                var pos = caret(this);
+                caret(this, pos.begin - 1);
+                break;
+            }
+        }
+        case keyCodes.RIGHT: {
+            if (modifier == undefined) {
+                var pos = caret(this);
+                caret(this, pos.begin + 1);
+                break;
+            }
+        }
+        default: {
+            var keydown = $.Event("keydown"),
+                keypress = $.Event("keypress"),
+                keyup = $.Event("keyup");
+
+            if (!sendDummyKeydown) {
+                keydown.keyCode = keyCode;
+                if (modifier == keyCodes.CONTROL)
+                    keydown.ctrlKey = true;
+            }
+            $(this).trigger(keydown);
+            if (!keydown.isDefaultPrevented()) {
+                keypress.keyCode = keyCode;
+                if (modifier == keyCodes.CONTROL)
+                    keypress.ctrlKey = true;
+                $(this).trigger(keypress);
+                if (!keypress.isDefaultPrevented()) {
+                    keyup.keyCode = keyCode;
+                    if (modifier == keyCodes.CONTROL)
+                        keyup.ctrlKey = true;
+                    $(this).trigger(keyup);
+                }
+            }
+        }
+    }
+}
+$.fn.Type = function (inputStr) {
+    var $input = $(this);
+    $.each(inputStr.split(''), function (ndx, lmnt) {
+        $input.SendKey(lmnt);
+    });
+}
+
+$.fn.paste = function (inputStr) {
+    var $input = $(this);
+    $input[0]._valueSet(inputStr);
+    $input.trigger('paste');
+}

+ 0 - 98
qunit/tests.js

@@ -1,101 +1,3 @@
-var 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
-}
-function caret(input, begin, end) {
-    var npt = input.jquery && input.length > 0 ? input[0] : input, range;
-    if (typeof begin == 'number') {
-        if (!$(input).is(':visible')) {
-            return;
-        }
-        end = (typeof end == 'number') ? end : begin;
-        if (npt.setSelectionRange) {
-            npt.selectionStart = begin;
-            npt.selectionEnd = end;
-
-        } else if (npt.createTextRange) {
-            range = npt.createTextRange();
-            range.collapse(true);
-            range.moveEnd('character', end);
-            range.moveStart('character', begin);
-            range.select();
-        }
-    } else {
-        if (!$(input).is(':visible')) {
-            return { "begin": 0, "end": 0 };
-        }
-        if (npt.setSelectionRange) {
-            begin = npt.selectionStart;
-            end = npt.selectionEnd;
-        } else if (document.selection && document.selection.createRange) {
-            range = document.selection.createRange();
-            begin = 0 - range.duplicate().moveStart('character', -100000);
-            end = begin + range.text.length;
-        }
-        return { "begin": begin, "end": end };
-    }
-};
-$.fn.SendKey = function (keyCode, modifier) {
-    var sendDummyKeydown = false;
-    if (Object.prototype.toString.call(keyCode) == '[object String]') {
-        keyCode = keyCode.charCodeAt(0);
-        sendDummyKeydown = true;
-    }
-
-    switch (keyCode) {
-        case keyCodes.LEFT: {
-            if (modifier == undefined) {
-                var pos = caret(this);
-                caret(this, pos.begin - 1);
-                break;
-            }
-        }
-        case keyCodes.RIGHT: {
-            if (modifier == undefined) {
-                var pos = caret(this);
-                caret(this, pos.begin + 1);
-                break;
-            }
-        }
-        default: {
-            var keydown = $.Event("keydown"),
-                keypress = $.Event("keypress"),
-                keyup = $.Event("keyup");
-
-            if (!sendDummyKeydown) {
-                keydown.keyCode = keyCode;
-                if (modifier == keyCodes.CONTROL)
-                    keydown.ctrlKey = true;
-            }
-            $(this).trigger(keydown);
-            if (!keydown.isDefaultPrevented()) {
-                keypress.keyCode = keyCode;
-                if (modifier == keyCodes.CONTROL)
-                    keypress.ctrlKey = true;
-                $(this).trigger(keypress);
-                if (!keypress.isDefaultPrevented()) {
-                    keyup.keyCode = keyCode;
-                    if (modifier == keyCodes.CONTROL)
-                        keyup.ctrlKey = true;
-                    $(this).trigger(keyup);
-                }
-            }
-        }
-    }
-}
-$.fn.Type = function (inputStr) {
-    var $input = $(this);
-    $.each(inputStr.split(''), function (ndx, lmnt) {
-        $input.SendKey(lmnt);
-    });
-}
-
-$.fn.paste = function (inputStr) {
-    var $input = $(this);
-    $input[0]._valueSet(inputStr);
-    $input.trigger('paste');
-}
-
 module("Simple masking");
 
 test("inputmask(\"99-99-99\", { clearMaskOnLostFocus: false}", function () {