Browse Source

update binder

Robin Herbots 9 years ago
parent
commit
638a3ce271

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
 - 'casing': 'title' #1277
 
 ### Updates
+- better filter for input targets in inputmask.binder.js
 - improve alternation selection
 - removed nojumps option
 - update phone alias implementation

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.3.2-82",
+  "version": "3.3.2-88",
   "main": [
     "./dist/inputmask/inputmask.js"
   ],

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
   "name": "jquery_inputmask",
   "repository": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.2-82",
+  "version": "3.3.2-88",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "main": "./dist/jquery.inputmask.bundle.js",
   "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.2-82",
+  "version": "3.3.2-88",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery")) : factory(window.dependencyLib || jQuery);

+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
@@ -17,7 +17,7 @@
                     "#": opts.definitions[9]
                 };
                 var masks = opts.phoneCodes.sort(function(a, b) {
-                    var maska = (a.mask || a).replace(/#/g, "0").replace(/[\+\(\)#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "0").replace(/[\+\(\)#-]/g, "");
+                    var maska = (a.mask || a).replace(/#/g, "9").replace(/[\+\(\)#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "9").replace(/[\+\(\)#-]/g, "");
                     return maska < maskb ? -1 : 1;
                 });
                 return masks;

+ 1 - 1
dist/inputmask/inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);

+ 2 - 2
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function($) {
     function Inputmask(alias, options) {
@@ -2495,7 +2495,7 @@
                     "#": opts.definitions[9]
                 };
                 var masks = opts.phoneCodes.sort(function(a, b) {
-                    var maska = (a.mask || a).replace(/#/g, "0").replace(/[\+\(\)#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "0").replace(/[\+\(\)#-]/g, "");
+                    var maska = (a.mask || a).replace(/#/g, "9").replace(/[\+\(\)#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "9").replace(/[\+\(\)#-]/g, "");
                     return maska < maskb ? -1 : 1;
                 });
                 return masks;

+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  Input Mask plugin extensions

+ 1 - 1
dist/min/inputmask/inputmask.dependencyLib.jquery.min.js

@@ -3,6 +3,6 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  Input Mask plugin extensions

+ 1 - 1
dist/min/inputmask/inputmask.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  * Input Mask Core

+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  Input Mask plugin extensions

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


+ 1 - 1
dist/min/inputmask/inputmask.regex.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  Input Mask plugin extensions

+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-82
+* Version: 3.3.2-88
 */
 /*
  * Input Mask plugin for jquery

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


+ 2 - 2
extra/bindings/inputmask.binding.js

@@ -16,14 +16,14 @@ Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.p
 	(function($, Inputmask) {
 		$(document).ajaxComplete(function(event, xmlHttpRequest, ajaxOptions) {
 			if ($.inArray("html", ajaxOptions.dataTypes) !== -1) {
-				$(":input").each(function(ndx, lmnt) {
+				$(".inputmask, [data-inputmask]").each(function(ndx, lmnt) {
 					if (lmnt.inputmask === undefined) {
 						Inputmask().mask(lmnt);
 					}
 				});
 			}
 		}).ready(function() {
-			$(":input").each(function(ndx, lmnt) {
+			$(".inputmask, [data-inputmask]").each(function(ndx, lmnt) {
 				if (lmnt.inputmask === undefined) {
 					Inputmask().mask(lmnt);
 				}

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

@@ -25,8 +25,8 @@
 			mask: function (opts) {
 				opts.definitions = {"#": opts.definitions["9"]};
 				var masks = opts.phoneCodes.sort(function (a, b) {
-					var maska = (a.mask || a).replace(/#/g, "0").replace(/[\+\(\)#-]/g, ""),
-						maskb = (b.mask || b).replace(/#/g, "0").replace(/[\+\(\)#-]/g, "");
+					var maska = (a.mask || a).replace(/#/g, "9").replace(/[\+\(\)#-]/g, ""),
+						maskb = (b.mask || b).replace(/#/g, "9").replace(/[\+\(\)#-]/g, "");
 
 					return maska < maskb ? -1 : 1;
 				});

+ 1 - 1
package.json

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

+ 1 - 1
qunit/main_phone.js

@@ -3,7 +3,7 @@ define([
 	"tests_phone_world",
 	"tests_phonebe",
 	"tests_phonenl",
-	//"tests_phoneru"
+	"tests_phoneru"
 ], function(qunit) {
 	qunit.load();
 	qunit.start();

+ 6 - 1
qunit/tests_phone_world.js

@@ -27,7 +27,12 @@ define([
 		testmask.focus();
 
 		$.each(Inputmask.prototype.defaults.aliases.phone.phoneCodes, function (ndx, lmnt) {
-			var expected = lmnt.mask.replace(/#/g, "0"), input = expected;
+			var ndx = 1, input, expected = lmnt.mask;
+			while (expected.match(/#/)) {
+				expected = expected.replace(/#/, ndx++);
+				if (ndx > 9) ndx = 1;
+			}
+			input = expected;
 			//input = input.replace(/\+/g, "");
 			input = input.replace(/\(/g, "");
 			input = input.replace(/\)/g, "");

+ 7 - 1
qunit/tests_phonebe.js

@@ -27,7 +27,13 @@ define([
 		testmask.focus();
 
 		$.each(Inputmask.prototype.defaults.aliases.phonebe.phoneCodes, function (ndx, lmnt) {
-			var expected = lmnt.mask.replace(/#/g, "0"), input = expected;
+			var ndx = 1, input, expected = lmnt.mask;
+			while (expected.match(/#/)) {
+				expected = expected.replace(/#/, ndx++);
+				if (ndx > 9) ndx = 1;
+			}
+			input = expected;
+
 			//input = input.replace(/\+/g, "");
 			input = input.replace(/\(/g, "");
 			input = input.replace(/\)/g, "");

+ 6 - 1
qunit/tests_phonenl.js

@@ -27,7 +27,12 @@ define([
 		testmask.focus();
 
 		$.each(Inputmask.prototype.defaults.aliases.phonenl.phoneCodes, function (ndx, lmnt) {
-			var expected = lmnt.mask.replace(/#/g, "0"), input = expected;
+			var ndx = 1, input, expected = lmnt.mask;
+			while (expected.match(/#/)) {
+				expected = expected.replace(/#/, ndx++);
+				if (ndx > 9) ndx = 1;
+			}
+			input = expected;
 			//input = input.replace(/\+/g, "");
 			input = input.replace(/\(/g, "");
 			input = input.replace(/\)/g, "");

+ 7 - 2
qunit/tests_phoneru.js

@@ -26,8 +26,13 @@ define([
 
 		testmask.focus();
 
-		$.each(Inputmask.prototype.defaults.aliases.phoneru.phoneCodes, function (ndx, lmnt) {
-			var expected = lmnt.mask.replace(/#/g, "0"), input = expected;
+		$.each(Inputmask.prototype.defaults.aliases.phoneru.phoneCodes.slice(0,10), function (ndx, lmnt) {
+			var ndx = 1, input, expected = lmnt.mask;
+			while (expected.match(/#/)) {
+				expected = expected.replace(/#/, ndx++);
+				if (ndx > 9) ndx = 1;
+			}
+			input = expected;
 			//input = input.replace(/\+/g, "");
 			input = input.replace(/\(/g, "");
 			input = input.replace(/\)/g, "");