-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Milestone
Description
Not really an issue, but an enhancement proposal.
Let say you set this as translation 👍
$.jMaskGlobals = {
translation: {
'2': {pattern: /[A-Z]/, optional: true, uppercase : true},
'3': {pattern: /[A-Z]/, uppercase : true},
'4': {pattern: /[0-9]/, optional: true},
'5': {pattern: /[0-9]/},
'6': {pattern: /[A-Z0-9]/, uppercase : true},
'7': {pattern: /[A-Z0-9]/, optional: true, uppercase : true},
}
};
Where a new pattern option is available : uppercase
This changement then in 'behaviour' :
while (check()) {
var maskDigit = mask.charAt(m),
valDigit = value.charAt(v),
translation = jMask.translation[maskDigit];
if (translation) {
if (valDigit.match(translation.pattern) || (translation.uppercase && valDigit.toUpperCase().match(translation.pattern))) {
if (translation.uppercase) {
buf[addMethod](valDigit.toUpperCase());
} else {
buf[addMethod](valDigit);
}
if (translation.recursive) {
if (resetPos === -1) {
resetPos = m;
} else if (m === lastMaskChar) {
m = resetPos - offset;
}
if (lastMaskChar === resetPos) {
m -= offset;
}
}
m += offset;
} else if ... etc
allow users to not care about cap lock status 😉
Very usefull for fast and "blind entry" ...