raspisms/assets/js/intlTelInput/intlTelInput.min.js

5 lines
22 KiB
JavaScript
Raw Normal View History

2019-10-29 14:57:13 +01:00
/*
International Telephone Input v6.2.0
https://github.com/Bluefieldscom/intl-tel-input.git
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b,window,document)}):"object"==typeof module&&module.exports?module.exports=a(require("jquery"),window,document):a(jQuery,window,document)}(function(a,b,c,d){"use strict";function e(b,c){this.a=b,c&&(a.extend(c, c, {a:c.autoFormat,h:c.autoHideDialCode,d:c.defaultCountry,i:c.ipinfoToken,n:c.nationalMode,t:c.numberType,o:c.onlyCountries,p:c.preferredCountries,v:c.preventInvalidNumbers,u:c.utilsScript})),this.b=a.extend({},h,c),this.c=h,this.ns="."+f+g++,this.d=Boolean(b.setSelectionRange),this.e=Boolean(a(b).attr("placeholder")),this.f=f}var f="intlTelInput",g=1,h={allowExtensions:!1,a:!0,h:!0,autoPlaceholder:!0,d:"",geoIpLookup:null,n:!0,t:"MOBILE",o:[],p:["us","gb"],u:""},i={b:38,c:40,d:13,e:27,f:43,A:65,Z:90,g:48,h:57,i:32,Bi:8,TAB:9,k:46,l:17,m:91,n:224},j=!1;a(b).load(function(){j=!0}),e.prototype={_init:function(){return this.b.n&&(this.b.h=!1),navigator.userAgent.match(/IEMobile/i)&&(this.b.a=!1),this.isMobile=/Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.autoCountryDeferred=new a.Deferred,this.utilsScriptDeferred=new a.Deferred,this._b(),this._f(),this._h(),this._i(),this._initRequests(),[this.autoCountryDeferred,this.utilsScriptDeferred]},_b:function(){this._d(),this._e()},_c:function(a,b,c){b in this.m||(this.m[b]=[]);var d=c||0;this.m[b][d]=a},_d:function(){var b;if(this.b.o.length){for(b=0;b<this.b.o.length;b++)this.b.o[b]=this.b.o[b].toLowerCase();for(this.l=[],b=0;b<k.length;b++)-1!=a.inArray(k[b].iso2,this.b.o)&&this.l.push(k[b])}else this.l=k;for(this.m={},b=0;b<this.l.length;b++){var c=this.l[b];if(this._c(c.iso2,c.dialCode,c.priority),c.areaCodes)for(var d=0;d<c.areaCodes.length;d++)this._c(c.iso2,c.dialCode+c.areaCodes[d])}},_e:function(){this.n=[];for(var a=0;a<this.b.p.length;a++){var b=this.b.p[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.n.push(c)}},_f:function(){this.g=a(this.a),this.g.attr("autocomplete","off"),this.g.wrap(a("<div>",{"class":"intl-tel-input"})),this.flagsContainer=a("<div>",{"class":"flag-dropdown"}).insertBefore(this.g);var b=a("<div>",{tabindex:"0","class":"selected-flag"}).appendTo(this.flagsContainer);this.h=a("<div>",{"class":"iti-flag"}).appendTo(b),a("<div>",{"class":"arrow"}).appendTo(b),this.isMobile?this.i=a("<select>",{"class":"iti-mobile-select"}).appendTo(this.flagsContainer):(this.i=a("<ul>",{"class":"country-list v-hide"}).appendTo(this.flagsContainer),this.n.length&&!this.isMobile&&(this._g(this.n,"preferred"),a("<li>",{"class":"divider"}).appendTo(this.i))),this._g(this.l,""),this.isMobile||(this.j=this.i.outerHeight(),this.i.removeClass("v-hide").addClass("hide"),this.k=this.i.children(".country"))},_g:function(a,b){for(var c="",d=0;d<a.length;d++){var e=a[d];this.isMobile?(c+="<option data-dial-code='"+e.dialCode+"' value='"+e.iso2+"'>",c+=e.name+" +"+e.dialCode,c+="</option>"):(c+="<li class='country "+b+"' data-dial-code='"+e.dialCode+"' data-country-code='"+e.iso2+"'>",c+="<div class='flag'><div class='iti-flag "+e.iso2+"'></div></div>",c+="<span class='country-name'>"+e.name+"</span>",c+="<span class='dial-code'>+"+e.dialCode+"</span>",c+="</li>")}this.i.append(c)},_h:function(){var a=this.g.val();this._af(a)?this._v(a,!0):"auto"!=this.b.d&&(this.b.d=this.b.d?this._y(this.b.d.toLowerCase(),!1,!1):this.n.length?this.n[0]:this.l[0],this._z(this.b.d.iso2),a||this._ae(this.b.d.dialCode,!1)),a&&this._u(a)},_i:function(){var b=this;if(this._j(),(this.b.h||this.b.a)&&this._l(),this.isMobile)this.i.on("change"+this.ns,function(){b._ab(a(this).find("option:selected"))});else{var c=this.g.closest("label");c.length&&c.on("click"+this.ns,function(a){b.i.hasClass("hide")?b.g.focus():a.preventDefault()});var d=this.h.parent();d.on("click"+this.ns,function(){!b.i.hasClass("hide")||b.g.prop("disabled")||b.g.prop("readonly")||b._n()})}this.flagsContainer.on("keydown"+b.ns,function(a){var c=b.i.hasClass("hide");!c||a.which!=i.b&&a.which!=i.c&&a.which!=i.i&&a.which!=i.d||(a.preventDefault(),a.stopPropagation(),b._n()),a.which==i.TAB&&b._ac