]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/static/AdminLTE-2.3.7/plugins/input-mask/jquery.inputmask.phone.extensions.js
update sources to v12.1.0
[ceph.git] / ceph / src / pybind / mgr / dashboard / static / AdminLTE-2.3.7 / plugins / input-mask / jquery.inputmask.phone.extensions.js
1 /*
2 Input Mask plugin extensions
3 http://github.com/RobinHerbots/jquery.inputmask
4 Copyright (c) 2010 - 2014 Robin Herbots
5 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6 Version: 0.0.0
7
8 Phone extension.
9 When using this extension make sure you specify the correct url to get the masks
10
11 $(selector).inputmask("phone", {
12 url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
13 onKeyValidation: function () { //show some metadata in the console
14 console.log($(this).inputmask("getmetadata")["name_en"]);
15 }
16 });
17
18
19 */
20 (function ($) {
21 $.extend($.inputmask.defaults.aliases, {
22 'phone': {
23 url: "phone-codes/phone-codes.json",
24 mask: function (opts) {
25 opts.definitions = {
26 'p': {
27 validator: function () { return false; },
28 cardinality: 1
29 },
30 '#': {
31 validator: "[0-9]",
32 cardinality: 1
33 }
34 };
35 var maskList = [];
36 $.ajax({
37 url: opts.url,
38 async: false,
39 dataType: 'json',
40 success: function (response) {
41 maskList = response;
42 }
43 });
44
45 maskList.splice(0, 0, "+p(ppp)ppp-pppp");
46 return maskList;
47 }
48 }
49 });
50 })(jQuery);