Robin Herbots 12 years ago
parent
commit
de0c0e9d64

+ 1 - 1
build.properties

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

+ 3 - 0
build.xml

@@ -14,6 +14,7 @@
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
+	   <replaceregexp file="${srcdir}/jquery.inputmask.regex.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="./jquery.inputmask.jquery.json" match="&quot;version&quot;:.*" replace="&quot;version&quot;: &quot;${build.major}.${build.minor}.${build.revision}&quot;,"  byline="true"/>
 	</target>
 
@@ -23,6 +24,7 @@
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: 0.0.0"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: 0.0.0"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: 0.0.0"  byline="true"/>
+	   <replaceregexp file="${srcdir}/jquery.inputmask.regex.extensions.js" match="Version:.*" replace="Version: 0.0.0"  byline="true"/>
     </target>
 	
     <target name="jquery.inputmask" depends="init, updateVersions">
@@ -31,6 +33,7 @@
 			<fileset file="${srcdir}/jquery.inputmask.extensions.js"/>
 			<fileset file="${srcdir}/jquery.inputmask.date.extensions.js"/>
 			<fileset file="${srcdir}/jquery.inputmask.numeric.extensions.js"/>
+			<fileset file="${srcdir}/jquery.inputmask.regex.extensions.js"/>
         </concat>
     </target>
 

BIN
dist/jQuery.InputMask.2.2.13.nupkg


BIN
dist/jQuery.InputMask.2.2.14.nupkg


+ 57 - 4
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.2.13
+* Version: 2.2.14
 */
 
 (function ($) {
@@ -1348,7 +1348,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.2.13
+Version: 2.2.14
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1445,7 +1445,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.2.13
+Version: 2.2.14
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1938,7 +1938,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.2.13
+Version: 2.2.14
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2108,3 +2108,56 @@ Optional extensions on the jquery.inputmask base
         }
     });
 })(jQuery);
+/*
+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.2.14
+
+Regex extensions on the jquery.inputmask base
+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: 10, //needs to be computed
+            regex: null,
+            regexSplit: null,
+            definitions: {
+                'r': {
+                    validator: function (chrs, buffer, pos, strict, opts) {
+
+                        function analyseRegex() {  //ENHANCE ME
+                            opts.regexSplit = [];
+                            if (opts.regex.indexOf("*") != (opts.regex.length - 1)) {
+                                opts.regex += "{1}";
+                            }
+                            opts.regexSplit.push(opts.regex);
+                        }
+
+                        if (opts.regexSplit == null) {
+                            analyseRegex();
+                        }
+
+                        var cbuffer = buffer.slice(), regexPart = "", isValid = false;
+                        cbuffer.splice(pos, 0, chrs);
+                        var bufferStr = cbuffer.join('');
+                        for (var i = 0; i < opts.regexSplit.length; i++) {
+                            regexPart += opts.regexSplit[i];
+                            var exp = new RegExp("^" + regexPart + "$");
+                            isValid = exp.test(bufferStr);
+                            console.log(bufferStr + ' ' + isValid);
+                            if (isValid) break;
+                        }
+
+                        return isValid;
+                    },
+                    cardinality: 1
+                }
+            }
+        }
+    });
+})(jQuery);

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


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


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

@@ -1 +1 @@
-(function(){})(jQuery);
+(function(b){b.extend(b.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:10,regex:null,regexSplit:null,definitions:{r:{validator:function(f,c,d,e,a){null==a.regexSplit&&(a.regexSplit=[],a.regex.indexOf("*")!=a.regex.length-1&&(a.regex+="{1}"),a.regexSplit.push(a.regex));var b=c.slice(),c="",e=!1;b.splice(d,0,f);f=b.join("");for(d=0;d<a.regexSplit.length&&!(c+=a.regexSplit[d],e=RegExp("^"+c+"$").test(f),console.log(f+" "+e),e);d++);return e},cardinality:1}}}})})(jQuery);

+ 1 - 1
jquery.inputmask.jquery.json

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