Browse Source

Added a time input mask defined within an alias. alias = hh:mm:ss

Robin Herbots 14 years ago
parent
commit
85fc36578e
1 changed files with 22 additions and 6 deletions
  1. 22 6
      jquery.inputmask.extentions.js

+ 22 - 6
jquery.inputmask.extentions.js

@@ -1,17 +1,33 @@
 /*
 Input Mask plugin extentions
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 Robin Herbots
+Copyright (c) 2010 - 2011 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 
 Optional extentions on the jquery.inputmask base
 */
 
 $.extend($.inputmask.defaults.aliases, {
-        'date': {
-            "mask": "d/m/y"
-        },
-         'dd/mm/yyyy': {
-            "mask": "d/m/y"
+    'date': {
+        mask: "d/m/y"
+    },
+    'dd/mm/yyyy': {
+        mask: "d/m/y"
+    },
+    'hh:mm:ss': {
+        mask: "h:s:s",
+        autoUnmask: false,
+        definitions: {
+            'h': {
+                "validator": "[01][0-9]|2[0-3]",
+                "cardinality": 2,
+                "prevalidator": [{ "validator": "[0-2]", "cardinality": 1}]
+            },
+            's': {
+                "validator": "[0-5][0-9]",
+                "cardinality": 2,
+                "prevalidator": [{ "validator": "[0-5]", "cardinality": 1}]
+            },
         }
+    }
 });