Skip to content

Commit 6924dee

Browse files
committed
update phone alias
1 parent 325f052 commit 6924dee

35 files changed

+560
-502
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ All notable changes to this project will be documented in this file.
77
- 'casing': 'title' #1277
88

99
### Updates
10+
- update phone alias implementation
1011
- replaced radixFocus option by positionCaretOnClick. Allows choice for behavior of the caret on click. (none, lvp (default), radixFocus)
1112
- performance updates
1213
- getmasklength
13-
- set selective caching in getTests
14+
- use selective caching in getTests
1415

1516
### Fixed
1617
- Bug when typing after a fixed character #1299

README_phone.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# phone extensions
22

3+
In the inputmask.phone.extensions you can find the abstractphone alias which is like the base for the phone aliases.
4+
In the extra/phone-codes folder you find some implementations.
5+
6+
You need to include the inputmask.phone.extensions.js and the phonecodes from within the extra folder to use the phone alias.
7+
8+
39
```javascript
410
$(selector).inputmask("phone", {
5-
url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
611
onKeyValidation: function () { //show some metadata in the console
712
console.log($(this).inputmask("getmetadata")["city"]);
813
}
@@ -13,13 +18,6 @@ $(selector).inputmask("phone", {
1318
## Aliases
1419
- phone
1520
- phonebe
16-
17-
## Options
18-
19-
### url
20-
21-
Specify the url to fetch the phone codes.
22-
23-
### countrycode
24-
25-
Specify the countrycode to help determine phonenumbers when pasting or with an initialValue.
21+
- phonenl
22+
- phoneru
23+
- phoneuk

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.inputmask",
3-
"version": "3.3.2-15",
3+
"version": "3.3.2-19",
44
"main": [
55
"./dist/inputmask/inputmask.js"
66
],

component.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "jquery_inputmask",
33
"repository": "robinherbots/jquery.inputmask",
44
"description": "jquery.inputmask is a jquery plugin which create an input mask.",
5-
"version": "3.3.2-15",
5+
"version": "3.3.2-19",
66
"keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
77
"main": "./dist/jquery.inputmask.bundle.js",
88
"scripts": [

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "robinherbots/jquery.inputmask",
33
"description": "jquery.inputmask is a jquery plugin which create an input mask.",
4-
"version": "3.3.2-15",
4+
"version": "3.3.2-19",
55
"type": "library",
66
"keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
77
"homepage": "http://robinherbots.github.io/jquery.inputmask",

dist/inputmask/inputmask.date.extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

dist/inputmask/inputmask.dependencyLib.jquery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

dist/inputmask/inputmask.extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

dist/inputmask/inputmask.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery")) : factory(window.dependencyLib || jQuery);

dist/inputmask/inputmask.numeric.extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

dist/inputmask/inputmask.phone.extensions.js

+7-29
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,19 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
9-
"function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
9+
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
1010
}(function($, Inputmask) {
1111
return Inputmask.extendAliases({
12-
phone: {
13-
url: "phone-codes/phone-codes.js",
12+
abstractphone: {
1413
countrycode: "",
15-
phoneCodeCache: {},
14+
phoneCodes: [],
1615
mask: function(opts) {
17-
if (void 0 === opts.phoneCodeCache[opts.url]) {
18-
var maskList = [];
19-
opts.definitions["#"] = opts.definitions[9], $.ajax({
20-
url: opts.url,
21-
async: !1,
22-
type: "get",
23-
dataType: "json",
24-
success: function(response) {
25-
maskList = response;
26-
},
27-
error: function(xhr, ajaxOptions, thrownError) {
28-
alert(thrownError + " - " + opts.url);
29-
}
30-
}), opts.phoneCodeCache[opts.url] = maskList.sort(function(a, b) {
31-
return (a.mask || a) < (b.mask || b) ? -1 : 1;
32-
});
33-
}
34-
return opts.phoneCodeCache[opts.url];
16+
return opts.phoneCodes.sort(function(a, b) {
17+
return (a.mask || a) < (b.mask || b) ? -1 : 1;
18+
});
3519
},
3620
keepStatic: !1,
3721
nojumps: !0,
@@ -41,12 +25,6 @@
4125
return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
4226
processedValue;
4327
}
44-
},
45-
phonebe: {
46-
alias: "phone",
47-
url: "phone-codes/phone-be.js",
48-
countrycode: "32",
49-
nojumpsThreshold: 4
5028
}
5129
}), Inputmask;
5230
});

dist/inputmask/inputmask.regex.extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

dist/inputmask/jquery.inputmask.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function(factory) {
99
"function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);

dist/jquery.inputmask.bundle.js

+6-28
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/RobinHerbots/jquery.inputmask
44
* Copyright (c) 2010 - 2016 Robin Herbots
55
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6-
* Version: 3.3.2-15
6+
* Version: 3.3.2-19
77
*/
88
!function($) {
99
function Inputmask(alias, options) {
@@ -2488,29 +2488,13 @@
24882488
}), Inputmask;
24892489
}(jQuery, Inputmask), function($, Inputmask) {
24902490
return Inputmask.extendAliases({
2491-
phone: {
2492-
url: "phone-codes/phone-codes.js",
2491+
abstractphone: {
24932492
countrycode: "",
2494-
phoneCodeCache: {},
2493+
phoneCodes: [],
24952494
mask: function(opts) {
2496-
if (void 0 === opts.phoneCodeCache[opts.url]) {
2497-
var maskList = [];
2498-
opts.definitions["#"] = opts.definitions[9], $.ajax({
2499-
url: opts.url,
2500-
async: !1,
2501-
type: "get",
2502-
dataType: "json",
2503-
success: function(response) {
2504-
maskList = response;
2505-
},
2506-
error: function(xhr, ajaxOptions, thrownError) {
2507-
alert(thrownError + " - " + opts.url);
2508-
}
2509-
}), opts.phoneCodeCache[opts.url] = maskList.sort(function(a, b) {
2510-
return (a.mask || a) < (b.mask || b) ? -1 : 1;
2511-
});
2512-
}
2513-
return opts.phoneCodeCache[opts.url];
2495+
return opts.phoneCodes.sort(function(a, b) {
2496+
return (a.mask || a) < (b.mask || b) ? -1 : 1;
2497+
});
25142498
},
25152499
keepStatic: !1,
25162500
nojumps: !0,
@@ -2520,12 +2504,6 @@
25202504
return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
25212505
processedValue;
25222506
}
2523-
},
2524-
phonebe: {
2525-
alias: "phone",
2526-
url: "phone-codes/phone-be.js",
2527-
countrycode: "32",
2528-
nojumpsThreshold: 4
25292507
}
25302508
}), Inputmask;
25312509
}(jQuery, Inputmask), function($, Inputmask) {

0 commit comments

Comments
 (0)