mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
848e2edd74
@ -6,6 +6,8 @@ function phoneMask(fields) {
|
|||||||
var iti = intlTelInput(inputQuery, {
|
var iti = intlTelInput(inputQuery, {
|
||||||
hiddenInput: inputQuery.getAttribute('name'),
|
hiddenInput: inputQuery.getAttribute('name'),
|
||||||
class: "form-control",
|
class: "form-control",
|
||||||
|
formatOnDisplay: true,
|
||||||
|
nationalMode: true,
|
||||||
initialCountry: "auto",
|
initialCountry: "auto",
|
||||||
geoIpLookup: function (success, failure) {
|
geoIpLookup: function (success, failure) {
|
||||||
$.get("https://ipinfo.io", function () {
|
$.get("https://ipinfo.io", function () {
|
||||||
@ -14,9 +16,21 @@ function phoneMask(fields) {
|
|||||||
success(countryCode);
|
success(countryCode);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
addMask(iti, inputQuery);
|
||||||
|
$(inputQuery).on("countrychange", function(event) {
|
||||||
|
iti.setNumber("");
|
||||||
|
addMask(iti, inputQuery);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addMask(iti, inputQuery){
|
||||||
|
let selectedCountryData = iti.getSelectedCountryData();
|
||||||
|
let newPlaceholder = intlTelInputUtils.getExampleNumber(selectedCountryData.iso2, true, intlTelInputUtils.numberFormat.INTERNATIONAL);
|
||||||
|
$(inputQuery).inputmask({ mask: newPlaceholder.replace(/[0-9+]/ig,'9'), keepStatic: false });
|
||||||
|
}
|
||||||
|
|
||||||
// var fields_arr = fields.split(',');
|
// var fields_arr = fields.split(',');
|
||||||
// $.each(fields_arr, function (index, value) {
|
// $.each(fields_arr, function (index, value) {
|
||||||
// maskPhone($(value).attr('name'))
|
// maskPhone($(value).attr('name'))
|
||||||
@ -38,8 +52,8 @@ function phoneMask(fields) {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function controlNumber(inputQuery) {
|
function controlNumber(inputQuery) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user