Browse Source

atom-beatify

Robin Herbots 10 years ago
parent
commit
48dd90d3a3

+ 1 - 1
bower.json

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

+ 1 - 1
component.json

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

+ 1 - 1
composer.json

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

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
@@ -1020,7 +1020,7 @@
                 }
                 }
             }).bind("focus.inputmask", function(e) {
             }).bind("focus.inputmask", function(e) {
                 var input = ($(this), this), nptValue = input._valueGet();
                 var input = ($(this), this), nptValue = input._valueGet();
-                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())), 
+                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) ? input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : caret(input, seekNext(getLastValidPosition())), 
                 undoValue = getBuffer().join("");
                 undoValue = getBuffer().join("");
             }).bind("mouseleave.inputmask", function() {
             }).bind("mouseleave.inputmask", function() {
                 var $input = $(this), input = this;
                 var $input = $(this), input = this;

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.64-19
+* Version: 3.1.64-20
 */
 */
 !function($) {
 !function($) {
     function inputmask(options) {
     function inputmask(options) {
@@ -1018,7 +1018,7 @@
                 }
                 }
             }).bind("focus.inputmask", function(e) {
             }).bind("focus.inputmask", function(e) {
                 var input = ($(this), this), nptValue = input._valueGet();
                 var input = ($(this), this), nptValue = input._valueGet();
-                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())), 
+                opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) ? input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : caret(input, seekNext(getLastValidPosition())), 
                 undoValue = getBuffer().join("");
                 undoValue = getBuffer().join("");
             }).bind("mouseleave.inputmask", function() {
             }).bind("mouseleave.inputmask", function() {
                 var $input = $(this), input = this;
                 var $input = $(this), input = this;

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


+ 119 - 112
js/jquery.inputmask.extensions.js

@@ -7,116 +7,123 @@ Version: 0.0.0-dev
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
-(function ($) {
-    //extra definitions
-    $.extend($.inputmask.defaults.definitions, {
-        'A': {
-            validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-            cardinality: 1,
-            casing: "upper" //auto uppercasing
-        },
-        '#': {
-            validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-            cardinality: 1,
-            casing: "upper"
-        }
-    });
-    $.extend($.inputmask.defaults.aliases, {
-        'url': {
-            mask: "ir",
-            placeholder: "",
-            separator: "",
-            defaultPrefix: "http://",
-            regex: {
-                urlpre1: new RegExp("[fh]"),
-                urlpre2: new RegExp("(ft|ht)"),
-                urlpre3: new RegExp("(ftp|htt)"),
-                urlpre4: new RegExp("(ftp:|http|ftps)"),
-                urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
-                urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
-                urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
-                urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
-            },
-            definitions: {
-                'i': {
-                    validator: function (chrs, maskset, pos, strict, opts) {
-                        return true;
-                    },
-                    cardinality: 8,
-                    prevalidator: (function () {
-                        var result = [], prefixLimit = 8;
-                        for (var i = 0; i < prefixLimit; i++) {
-                            result[i] = (function () {
-                                var j = i;
-                                return {
-                                    validator: function (chrs, maskset, pos, strict, opts) {
-                                        if (opts.regex["urlpre" + (j + 1)]) {
-                                            var tmp = chrs, k;
-                                            if (((j + 1) - chrs.length) > 0) {
-                                                tmp = maskset.buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
-                                            }
-                                            var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
-                                            if (!strict && !isValid) {
-                                                pos = pos - j;
-                                                for (k = 0; k < opts.defaultPrefix.length; k++) {
-                                                    maskset.buffer[pos] = opts.defaultPrefix[k]; pos++;
-                                                }
-                                                for (k = 0; k < tmp.length - 1; k++) {
-                                                    maskset.buffer[pos] = tmp[k]; pos++;
-                                                }
-                                                return { "pos": pos };
-                                            }
-                                            return isValid;
-                                        } else {
-                                            return false;
-                                        }
-                                    }, cardinality: j
-                                };
-                            })();
-                        }
-                        return result;
-                    })()
-                },
-                "r": {
-                    validator: ".",
-                    cardinality: 50
-                }
-            },
-            insertMode: false,
-            autoUnmask: false
-        },
-        "ip": { //ip-address mask
-            mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
-            definitions: {
-                'i': {
-                    validator: function (chrs, maskset, pos, strict, opts) {
-                        if (pos - 1 > -1 && maskset.buffer[pos - 1] != ".") {
-                            chrs = maskset.buffer[pos - 1] + chrs;
-                            if (pos - 2 > -1 && maskset.buffer[pos - 2] != ".") {
-                                chrs = maskset.buffer[pos - 2] + chrs;
-                            } else chrs = "0" + chrs;
-                        } else chrs = "00" + chrs;
-                        return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
-                    },
-                    cardinality: 1
-                }
-            }
-        },
-        "email": {
-            mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{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"
-                }
-            }
-        }
-    });
-    return $.fn.inputmask;
+(function($) {
+	//extra definitions
+	$.extend($.inputmask.defaults.definitions, {
+		'A': {
+			validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+			cardinality: 1,
+			casing: "upper" //auto uppercasing
+		},
+		'#': {
+			validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+			cardinality: 1,
+			casing: "upper"
+		}
+	});
+	$.extend($.inputmask.defaults.aliases, {
+		'url': {
+			mask: "ir",
+			placeholder: "",
+			separator: "",
+			defaultPrefix: "http://",
+			regex: {
+				urlpre1: new RegExp("[fh]"),
+				urlpre2: new RegExp("(ft|ht)"),
+				urlpre3: new RegExp("(ftp|htt)"),
+				urlpre4: new RegExp("(ftp:|http|ftps)"),
+				urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
+				urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
+				urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
+				urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
+			},
+			definitions: {
+				'i': {
+					validator: function(chrs, maskset, pos, strict, opts) {
+						return true;
+					},
+					cardinality: 8,
+					prevalidator: (function() {
+						var result = [],
+							prefixLimit = 8;
+						for (var i = 0; i < prefixLimit; i++) {
+							result[i] = (function() {
+								var j = i;
+								return {
+									validator: function(chrs, maskset, pos, strict, opts) {
+										if (opts.regex["urlpre" + (j + 1)]) {
+											var tmp = chrs,
+												k;
+											if (((j + 1) - chrs.length) > 0) {
+												tmp = maskset.buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
+											}
+											var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
+											if (!strict && !isValid) {
+												pos = pos - j;
+												for (k = 0; k < opts.defaultPrefix.length; k++) {
+													maskset.buffer[pos] = opts.defaultPrefix[k];
+													pos++;
+												}
+												for (k = 0; k < tmp.length - 1; k++) {
+													maskset.buffer[pos] = tmp[k];
+													pos++;
+												}
+												return {
+													"pos": pos
+												};
+											}
+											return isValid;
+										} else {
+											return false;
+										}
+									},
+									cardinality: j
+								};
+							})();
+						}
+						return result;
+					})()
+				},
+				"r": {
+					validator: ".",
+					cardinality: 50
+				}
+			},
+			insertMode: false,
+			autoUnmask: false
+		},
+		"ip": { //ip-address mask
+			mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
+			definitions: {
+				'i': {
+					validator: function(chrs, maskset, pos, strict, opts) {
+						if (pos - 1 > -1 && maskset.buffer[pos - 1] != ".") {
+							chrs = maskset.buffer[pos - 1] + chrs;
+							if (pos - 2 > -1 && maskset.buffer[pos - 2] != ".") {
+								chrs = maskset.buffer[pos - 2] + chrs;
+							} else chrs = "0" + chrs;
+						} else chrs = "00" + chrs;
+						return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
+					},
+					cardinality: 1
+				}
+			}
+		},
+		"email": {
+			mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{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"
+				}
+			}
+		}
+	});
+	return $.fn.inputmask;
 })(jQuery);
 })(jQuery);

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


File diff suppressed because it is too large
+ 562 - 457
js/jquery.inputmask.numeric.extensions.js


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

@@ -17,50 +17,50 @@ When using this extension make sure you specify the correct url to get the masks
 
 
 
 
 */
 */
-(function ($) {
-    $.extend($.inputmask.defaults.aliases, {
-        'phone': {
-            url: "phone-codes/phone-codes.js",
-            countrycode: "",
-            mask: function (opts) {
-                opts.definitions['#'] = opts.definitions['9'];
-                var maskList = [];
-                $.ajax({
-                    url: opts.url,
-                    async: false,
-                    dataType: 'json',
-                    success: function (response) {
-                        maskList = response;
-                    },
-                    error: function (xhr, ajaxOptions, thrownError) {
-                        alert(thrownError + " - " + opts.url);
-                    }
-                });
+(function($) {
+	$.extend($.inputmask.defaults.aliases, {
+		'phone': {
+			url: "phone-codes/phone-codes.js",
+			countrycode: "",
+			mask: function(opts) {
+				opts.definitions['#'] = opts.definitions['9'];
+				var maskList = [];
+				$.ajax({
+					url: opts.url,
+					async: false,
+					dataType: 'json',
+					success: function(response) {
+						maskList = response;
+					},
+					error: function(xhr, ajaxOptions, thrownError) {
+						alert(thrownError + " - " + opts.url);
+					}
+				});
 
 
-                maskList = maskList.sort(function (a, b) {
-                    return (a["mask"] || a) < (b["mask"] || b) ? -1 : 1;
-                });
+				maskList = maskList.sort(function(a, b) {
+					return (a["mask"] || a) < (b["mask"] || b) ? -1 : 1;
+				});
 
 
-                return maskList;
-            },
-            keepStatic: false,
-            nojumps: true,
-            nojumpsThreshold: 1,
-            onBeforeMask: function (value, opts) {
-                var processedValue = value.replace(/^0/g, "");
-                if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) == -1) {
-                    processedValue = "+" + opts.countrycode + processedValue;
-                }
+				return maskList;
+			},
+			keepStatic: false,
+			nojumps: true,
+			nojumpsThreshold: 1,
+			onBeforeMask: function(value, opts) {
+				var processedValue = value.replace(/^0/g, "");
+				if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) == -1) {
+					processedValue = "+" + opts.countrycode + processedValue;
+				}
 
 
-                return processedValue;
-            }
-        },
-        'phonebe': {
-            alias: "phone",
-            url: "phone-codes/phone-be.js",
-            countrycode: "32",
-            nojumpsThreshold: 4
-        }
-    });
-    return $.fn.inputmask;
+				return processedValue;
+			}
+		},
+		'phonebe': {
+			alias: "phone",
+			url: "phone-codes/phone-be.js",
+			countrycode: "32",
+			nojumpsThreshold: 4
+		}
+	});
+	return $.fn.inputmask;
 })(jQuery);
 })(jQuery);

+ 182 - 167
js/jquery.inputmask.regex.extensions.js

@@ -8,181 +8,196 @@ Version: 0.0.0-dev
 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
 */
 */
-(function ($) {
-    $.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"}
-        'Regex': {
-            mask: "r",
-            greedy: false,
-            repeat: "*",
-            regex: null,
-            regexTokens: null,
-            //Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex
-            tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
-            quantifierFilter: /[0-9]+[^,]/,
-            isComplete: function(buffer, opts){
-            	return new RegExp(opts.regex).test(buffer.join(''));
-            },
-            definitions: {
-                'r': {
-                    validator: function (chrs, maskset, pos, strict, opts) {
-                        function regexToken(isGroup, isQuantifier) {
-                            this.matches = [];
-                            this.isGroup = isGroup || false;
-                            this.isQuantifier = isQuantifier || false;
-                            this.quantifier = { min: 1, max: 1 };
-                            this.repeaterPart = undefined;
-                        }
-                        function analyseRegex() {
-                            var currentToken = new regexToken(), match, m, opengroups = [];
+(function($) {
+	$.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"}
+		'Regex': {
+			mask: "r",
+			greedy: false,
+			repeat: "*",
+			regex: null,
+			regexTokens: null,
+			//Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex
+			tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
+			quantifierFilter: /[0-9]+[^,]/,
+			isComplete: function(buffer, opts) {
+				return new RegExp(opts.regex).test(buffer.join(''));
+			},
+			definitions: {
+				'r': {
+					validator: function(chrs, maskset, pos, strict, opts) {
+						function regexToken(isGroup, isQuantifier) {
+							this.matches = [];
+							this.isGroup = isGroup || false;
+							this.isQuantifier = isQuantifier || false;
+							this.quantifier = {
+								min: 1,
+								max: 1
+							};
+							this.repeaterPart = undefined;
+						}
 
 
-                            opts.regexTokens = [];
+						function analyseRegex() {
+							var currentToken = new regexToken(),
+								match, m, opengroups = [];
 
 
-                            // The tokenizer regex does most of the tokenization grunt work
-                            while (match = opts.tokenizer.exec(opts.regex)) {
-                                m = match[0];
-                                switch (m.charAt(0)) {
-                                    case "(": // Group opening
-                                        opengroups.push(new regexToken(true));
-                                        break;
-                                    case ")": // Group closing
-                                        var groupToken = opengroups.pop();
-                                        if (opengroups.length > 0) {
-                                            opengroups[opengroups.length - 1]["matches"].push(groupToken);
-                                        } else {
-                                            currentToken.matches.push(groupToken);
-                                        }
-                                        break;
-                                    case "{": case "+": case "*": //Quantifier
-                                        var quantifierToken = new regexToken(false, true);
-                                        m = m.replace(/[{}]/g, "");
-                                        var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = mq.length == 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
-                                        quantifierToken.quantifier = { min: mq0, max: mq1 };
-                                        if (opengroups.length > 0) {
-                                            var matches = opengroups[opengroups.length - 1]["matches"];
-                                            match = matches.pop();
-                                            if (!match["isGroup"]) {
-                                                var groupToken = new regexToken(true);
-                                                groupToken.matches.push(match);
-                                                match = groupToken;
-                                            }
-                                            matches.push(match);
-                                            matches.push(quantifierToken);
-                                        } else {
-                                            match = currentToken.matches.pop();
-                                            if (!match["isGroup"]) {
-                                                var groupToken = new regexToken(true);
-                                                groupToken.matches.push(match);
-                                                match = groupToken;
-                                            }
-                                            currentToken.matches.push(match);
-                                            currentToken.matches.push(quantifierToken);
-                                        }
-                                        break;
-                                    default:
-                                        if (opengroups.length > 0) {
-                                            opengroups[opengroups.length - 1]["matches"].push(m);
-                                        } else {
-                                            currentToken.matches.push(m);
-                                        }
-                                        break;
-                                }
-                            }
+							opts.regexTokens = [];
 
 
-                            if (currentToken.matches.length > 0)
-                                opts.regexTokens.push(currentToken);
-                        };
+							// The tokenizer regex does most of the tokenization grunt work
+							while (match = opts.tokenizer.exec(opts.regex)) {
+								m = match[0];
+								switch (m.charAt(0)) {
+									case "(": // Group opening
+										opengroups.push(new regexToken(true));
+										break;
+									case ")": // Group closing
+										var groupToken = opengroups.pop();
+										if (opengroups.length > 0) {
+											opengroups[opengroups.length - 1]["matches"].push(groupToken);
+										} else {
+											currentToken.matches.push(groupToken);
+										}
+										break;
+									case "{":
+									case "+":
+									case "*": //Quantifier
+										var quantifierToken = new regexToken(false, true);
+										m = m.replace(/[{}]/g, "");
+										var mq = m.split(","),
+											mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]),
+											mq1 = mq.length == 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
+										quantifierToken.quantifier = {
+											min: mq0,
+											max: mq1
+										};
+										if (opengroups.length > 0) {
+											var matches = opengroups[opengroups.length - 1]["matches"];
+											match = matches.pop();
+											if (!match["isGroup"]) {
+												var groupToken = new regexToken(true);
+												groupToken.matches.push(match);
+												match = groupToken;
+											}
+											matches.push(match);
+											matches.push(quantifierToken);
+										} else {
+											match = currentToken.matches.pop();
+											if (!match["isGroup"]) {
+												var groupToken = new regexToken(true);
+												groupToken.matches.push(match);
+												match = groupToken;
+											}
+											currentToken.matches.push(match);
+											currentToken.matches.push(quantifierToken);
+										}
+										break;
+									default:
+										if (opengroups.length > 0) {
+											opengroups[opengroups.length - 1]["matches"].push(m);
+										} else {
+											currentToken.matches.push(m);
+										}
+										break;
+								}
+							}
 
 
-                        function validateRegexToken(token, fromGroup) {
-                            var isvalid = false;
-                            if (fromGroup) {
-                                regexPart += "(";
-                                openGroupCount++;
-                            }
-                            for (var mndx = 0; mndx < token["matches"].length; mndx++) {
-                                var matchToken = token["matches"][mndx];
-                                if (matchToken["isGroup"] == true) {
-                                    isvalid = validateRegexToken(matchToken, true);
-                                } else if (matchToken["isQuantifier"] == true) {
-                                    var crrntndx = $.inArray(matchToken, token["matches"]),
-                                        matchGroup = token["matches"][crrntndx - 1];
-                                    var regexPartBak = regexPart;
-                                    if (isNaN(matchToken.quantifier.max)) {
-                                        while (matchToken["repeaterPart"] && matchToken["repeaterPart"] != regexPart && matchToken["repeaterPart"].length > regexPart.length) {
-                                            isvalid = validateRegexToken(matchGroup, true);
-                                            if (isvalid) break;
-                                        }
-                                        isvalid = isvalid || validateRegexToken(matchGroup, true);
-                                        if (isvalid) matchToken["repeaterPart"] = regexPart;
-                                        regexPart = regexPartBak + matchToken.quantifier.max;
-                                    } else {
-                                        for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm; i++) {
-                                            isvalid = validateRegexToken(matchGroup, true);
-                                            if (isvalid) break;
-                                        }
-                                        regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
-                                    }
-                                } else if (matchToken["matches"] != undefined) {
-                                    for (var k = 0; k < matchToken.length; k++) {
-                                        isvalid = validateRegexToken(matchToken[k], fromGroup);
-                                        if (isvalid) break;
-                                    }
-                                } else {
-                                    var testExp;
-                                    if (matchToken.charAt(0) == "[") {
-                                        testExp = regexPart;
-                                        testExp += matchToken;
-                                        for (var j = 0; j < openGroupCount; j++) {
-                                            testExp += ")";
-                                        }
-                                        var exp = new RegExp("^(" + testExp + ")$");
-                                        isvalid = exp.test(bufferStr);
-                                    } else {
-                                        for (var l = 0, tl = matchToken.length; l < tl; l++) {
-                                            if (matchToken.charAt(l) == "\\") continue;
-                                            testExp = regexPart;
-                                            testExp += matchToken.substr(0, l + 1);
-                                            testExp = testExp.replace(/\|$/, "");
-                                            for (var j = 0; j < openGroupCount; j++) {
-                                                testExp += ")";
-                                            }
-                                            var exp = new RegExp("^(" + testExp + ")$");
-                                            isvalid = exp.test(bufferStr);
-                                            if (isvalid) break;
-                                        }
-                                    }
-                                    regexPart += matchToken;
-                                }
-                                if (isvalid) break;
-                            }
+							if (currentToken.matches.length > 0)
+								opts.regexTokens.push(currentToken);
+						};
 
 
-                            if (fromGroup) {
-                                regexPart += ")";
-                                openGroupCount--;
-                            }
+						function validateRegexToken(token, fromGroup) {
+							var isvalid = false;
+							if (fromGroup) {
+								regexPart += "(";
+								openGroupCount++;
+							}
+							for (var mndx = 0; mndx < token["matches"].length; mndx++) {
+								var matchToken = token["matches"][mndx];
+								if (matchToken["isGroup"] == true) {
+									isvalid = validateRegexToken(matchToken, true);
+								} else if (matchToken["isQuantifier"] == true) {
+									var crrntndx = $.inArray(matchToken, token["matches"]),
+										matchGroup = token["matches"][crrntndx - 1];
+									var regexPartBak = regexPart;
+									if (isNaN(matchToken.quantifier.max)) {
+										while (matchToken["repeaterPart"] && matchToken["repeaterPart"] != regexPart && matchToken["repeaterPart"].length > regexPart.length) {
+											isvalid = validateRegexToken(matchGroup, true);
+											if (isvalid) break;
+										}
+										isvalid = isvalid || validateRegexToken(matchGroup, true);
+										if (isvalid) matchToken["repeaterPart"] = regexPart;
+										regexPart = regexPartBak + matchToken.quantifier.max;
+									} else {
+										for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm; i++) {
+											isvalid = validateRegexToken(matchGroup, true);
+											if (isvalid) break;
+										}
+										regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
+									}
+								} else if (matchToken["matches"] != undefined) {
+									for (var k = 0; k < matchToken.length; k++) {
+										isvalid = validateRegexToken(matchToken[k], fromGroup);
+										if (isvalid) break;
+									}
+								} else {
+									var testExp;
+									if (matchToken.charAt(0) == "[") {
+										testExp = regexPart;
+										testExp += matchToken;
+										for (var j = 0; j < openGroupCount; j++) {
+											testExp += ")";
+										}
+										var exp = new RegExp("^(" + testExp + ")$");
+										isvalid = exp.test(bufferStr);
+									} else {
+										for (var l = 0, tl = matchToken.length; l < tl; l++) {
+											if (matchToken.charAt(l) == "\\") continue;
+											testExp = regexPart;
+											testExp += matchToken.substr(0, l + 1);
+											testExp = testExp.replace(/\|$/, "");
+											for (var j = 0; j < openGroupCount; j++) {
+												testExp += ")";
+											}
+											var exp = new RegExp("^(" + testExp + ")$");
+											isvalid = exp.test(bufferStr);
+											if (isvalid) break;
+										}
+									}
+									regexPart += matchToken;
+								}
+								if (isvalid) break;
+							}
 
 
-                            return isvalid;
-                        }
+							if (fromGroup) {
+								regexPart += ")";
+								openGroupCount--;
+							}
 
 
+							return isvalid;
+						}
 
 
-                        if (opts.regexTokens == null) {
-                            analyseRegex();
-                        }
 
 
-                        var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = false, openGroupCount = 0;
-                        cbuffer.splice(pos, 0, chrs);
-                        var bufferStr = cbuffer.join('');
-                        for (var i = 0; i < opts.regexTokens.length; i++) {
-                            var regexToken = opts.regexTokens[i];
-                            isValid = validateRegexToken(regexToken, regexToken["isGroup"]);
-                            if (isValid) break;
-                        }
+						if (opts.regexTokens == null) {
+							analyseRegex();
+						}
 
 
-                        return isValid;
-                    },
-                    cardinality: 1
-                }
-            }
-        }
-    });
-    return $.fn.inputmask;
+						var cbuffer = maskset.buffer.slice(),
+							regexPart = "",
+							isValid = false,
+							openGroupCount = 0;
+						cbuffer.splice(pos, 0, chrs);
+						var bufferStr = cbuffer.join('');
+						for (var i = 0; i < opts.regexTokens.length; i++) {
+							var regexToken = opts.regexTokens[i];
+							isValid = validateRegexToken(regexToken, regexToken["isGroup"]);
+							if (isValid) break;
+						}
+
+						return isValid;
+					},
+					cardinality: 1
+				}
+			}
+		}
+	});
+	return $.fn.inputmask;
 })(jQuery);
 })(jQuery);

+ 1 - 1
package.json

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