|
|
@@ -3,7 +3,7 @@ Input Mask plugin for jquery
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 0.4.6
|
|
|
+Version: 0.4.6a
|
|
|
|
|
|
This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
|
|
|
*/
|
|
|
@@ -30,23 +30,23 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
|
|
|
clearMaskOnLostFocus: true,
|
|
|
insertMode: true, //insert the input or overwrite the input
|
|
|
clearIncomplete: false, //clear the incomplete input on blur
|
|
|
- autoCasing: null, //upper | lower automatic casing of the input
|
|
|
aliases: {}, //aliases definitions => see jquery.inputmask.extentions.js
|
|
|
definitions: {
|
|
|
'9': {
|
|
|
- "validator": "[0-9]",
|
|
|
- "cardinality": 1,
|
|
|
- 'prevalidator': null
|
|
|
+ validator: "[0-9]",
|
|
|
+ cardinality: 1,
|
|
|
+ prevalidator: null
|
|
|
},
|
|
|
'a': {
|
|
|
- "validator": "[A-Za-z]",
|
|
|
- "cardinality": 1,
|
|
|
- "prevalidator": null
|
|
|
+ validator: "[A-Za-z]",
|
|
|
+ cardinality: 1,
|
|
|
+ prevalidator: null
|
|
|
+ //,casing: "upper" //casing option "upper" => toUpperCase, "lower" => toLowerCase
|
|
|
},
|
|
|
'*': {
|
|
|
- "validator": "[A-Za-z0-9]",
|
|
|
- "cardinality": 1,
|
|
|
- "prevalidator": null
|
|
|
+ validator: "[A-Za-z0-9]",
|
|
|
+ cardinality: 1,
|
|
|
+ prevalidator: null
|
|
|
}
|
|
|
},
|
|
|
keyCode: { 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,
|
|
|
@@ -222,13 +222,13 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
|
|
|
var prevalidators = maskdef["prevalidator"], prevalidatorsL = prevalidators ? prevalidators.length : 0;
|
|
|
for (i = 1; i < maskdef.cardinality; i++) {
|
|
|
var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator["validator"], cardinality = prevalidator["cardinality"];
|
|
|
- outElem.push({ fn: validator ? typeof validator == 'string' ? new RegExp(validator) : new function() { this.test = validator; } : new RegExp("."), cardinality: cardinality ? cardinality : 1, optionality: isOptional, newBlockMarker: isOptional == true ? newBlockMarker : false, offset: 0 });
|
|
|
+ outElem.push({ fn: validator ? typeof validator == 'string' ? new RegExp(validator) : new function() { this.test = validator; } : new RegExp("."), cardinality: cardinality ? cardinality : 1, optionality: isOptional, newBlockMarker: isOptional == true ? newBlockMarker : false, offset: 0, casing: maskdef["casing"] });
|
|
|
if (isOptional == true) //reset newBlockMarker
|
|
|
newBlockMarker = false;
|
|
|
}
|
|
|
- outElem.push({ fn: maskdef.validator ? typeof maskdef.validator == 'string' ? new RegExp(maskdef.validator) : new function() { this.test = maskdef.validator; } : new RegExp("."), cardinality: maskdef.cardinality, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0 });
|
|
|
+ outElem.push({ fn: maskdef.validator ? typeof maskdef.validator == 'string' ? new RegExp(maskdef.validator) : new function() { this.test = maskdef.validator; } : new RegExp("."), cardinality: maskdef.cardinality, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: maskdef["casing"] });
|
|
|
} else {
|
|
|
- outElem.push({ fn: null, cardinality: 0, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0 });
|
|
|
+ outElem.push({ fn: null, cardinality: 0, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: null });
|
|
|
escaped = false;
|
|
|
}
|
|
|
//reset newBlockMarker
|
|
|
@@ -290,17 +290,18 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
|
|
|
//these are needed to handle the non-greedy mask repetitions
|
|
|
function setBufferElement(buffer, position, element) {
|
|
|
prepareBuffer(buffer, position);
|
|
|
-
|
|
|
+
|
|
|
+ var test = tests[determineTestPosition(position)];
|
|
|
var elem = element;
|
|
|
- switch(opts.autoCasing){
|
|
|
- case "upper":
|
|
|
- elem = element.toUpperCase();
|
|
|
- break;
|
|
|
- case "lower":
|
|
|
- elem = element.toLowerCase();
|
|
|
- break;
|
|
|
+ switch (test.casing) {
|
|
|
+ case "upper":
|
|
|
+ elem = element.toUpperCase();
|
|
|
+ break;
|
|
|
+ case "lower":
|
|
|
+ elem = element.toLowerCase();
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
buffer[position] = elem;
|
|
|
}
|
|
|
function getBufferElement(buffer, position) {
|