dash-stack/contrib/AdminLTE/plugins/input-mask/jquery.inputmask.phone.extensions.js
Paarhati Ozkasgarli 3db5fc2f12 Moving to Django
dash-stack orginally was tought as Python Flask project.
After some heatet argument and strong considiration we
have decided to move the project to Django.

This commit is the initial commit for moving project to
Django.

Change-Id: Id28e3cf1dafbed7dd647b1020376bae893f5c3a2
Signed-off-by: Paarhati Ozkasgarli <ozkasgarli@gmail.com>
2016-11-21 19:28:30 +00:00

51 lines
1.5 KiB
JavaScript

/*
Input Mask plugin extensions
http://github.com/RobinHerbots/jquery.inputmask
Copyright (c) 2010 - 2014 Robin Herbots
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
Version: 0.0.0
Phone extension.
When using this extension make sure you specify the correct url to get the masks
$(selector).inputmask("phone", {
url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
onKeyValidation: function () { //show some metadata in the console
console.log($(this).inputmask("getmetadata")["name_en"]);
}
});
*/
(function ($) {
$.extend($.inputmask.defaults.aliases, {
'phone': {
url: "phone-codes/phone-codes.json",
mask: function (opts) {
opts.definitions = {
'p': {
validator: function () { return false; },
cardinality: 1
},
'#': {
validator: "[0-9]",
cardinality: 1
}
};
var maskList = [];
$.ajax({
url: opts.url,
async: false,
dataType: 'json',
success: function (response) {
maskList = response;
}
});
maskList.splice(0, 0, "+p(ppp)ppp-pppp");
return maskList;
}
}
});
})(jQuery);