You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5 lines
26 KiB

4 years ago
  1. /*
  2. * International Telephone Input v12.1.3
  3. * https://github.com/jackocnr/intl-tel-input.git
  4. * Licensed under the MIT license
  5. */
  6. !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 = a(b), this.b = a.extend({}, h, c), this.ns = "." + f + g++ , this.d = Boolean(b.setSelectionRange), this.e = Boolean(a(b).attr("placeholder")) } var f = "intlTelInput", g = 1, h = { allowDropdown: 0, autoHideDialCode: !0, autoPlaceholder: "polite", customPlaceholder: null, dropdownContainer: "", excludeCountries: [], formatOnDisplay: !0, geoIpLookup: null, hiddenInput: "", initialCountry: "", nationalMode: !0, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: ["us", "gb"], separateDialCode: !1, utilsScript: "" }, i = { b: 38, c: 40, d: 13, e: 27, f: 43, A: 65, Z: 90, j: 32, k: 9 }, j = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"]; a(b).on("load", function () { a.fn[f].windowLoaded = !0 }), e.prototype = { _a: function () { return this.b.nationalMode && (this.b.autoHideDialCode = !1), this.b.separateDialCode && (this.b.autoHideDialCode = this.b.nationalMode = !1), this.g = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), this.g && (a("body").addClass("iti-mobile"), this.b.dropdownContainer || (this.b.dropdownContainer = "body")), this.h = new a.Deferred, this.i = new a.Deferred, this.s = {}, this._b(), this._f(), this._h(), this._i(), this._i2(), [this.h, this.i] }, _b: function () { this._d(), this._d2(), this._e() }, _c: function (a, b, c) { b in this.q || (this.q[b] = []); var d = c || 0; this.q[b][d] = a }, _d: function () { if (this.b.onlyCountries.length) { var a = this.b.onlyCountries.map(function (a) { return a.toLowerCase() }); this.p = k.filter(function (b) { return a.indexOf(b.iso2) > -1 }) } else if (this.b.excludeCountries.length) { var b = this.b.excludeCountries.map(function (a) { return a.toLowerCase() }); this.p = k.filter(function (a) { return b.indexOf(a.iso2) === -1 }) } else this.p = k }, _d2: function () { this.q = {}; for (var a = 0; a < this.p.length; a++) { var b = this.p[a]; if (this._c(b.iso2, b.dialCode, b.priority), b.areaCodes) for (var c = 0; c < b.areaCodes.length; c++)this._c(b.iso2, b.dialCode + b.areaCodes[c]) } }, _e: function () { this.preferredCountries = []; for (var a = 0; a < this.b.preferredCountries.length; a++) { var b = this.b.preferredCountries[a].toLowerCase(), c = this._y(b, !1, !0); c && this.preferredCountries.push(c) } }, _f: function () { this.a.attr("autocomplete", "off"); var b = "intl-tel-input"; this.b.allowDropdown && (b += " allow-dropdown"), this.b.separateDialCode && (b += " separate-dial-code"), this.a.wrap(a("<div>", { "class": b })), this.k = a("<div>", { "class": "flag-container" }).insertBefore(this.a); var c = a("<div>", { "class": "selected-flag" }); c.appendTo(this.k), this.l = a("<div>", { "class": "iti-flag" }).appendTo(c), this.b.separateDialCode && (this.t = a("<div>", { "class": "selected-dial-code" }).appendTo(c)), this.b.allowDropdown ? (c.attr("tabindex", "0"), a("<div>", { "class": "iti-arrow" }).appendTo(c), this.m = a("<ul>", { "class": "country-list hide" }), this.preferredCountries.length && (this._g(this.preferredCountries, "preferred"), a("<li>", { "class": "divider" }).appendTo(this.m)), this._g(this.p, ""), this.o = this.m.children(".country"), this.b.dropdownContainer ? this.dropdown = a("<div>", { "class": "intl-tel-input iti-container" }).append(this.m) : this.m.appendTo(this.k)) : this.o = a(), this.b.hiddenInput && (this.hiddenInput = a("<input>", { type: "hidden", name: this.b.hiddenInput }).insertBefore(this.a)) }, _g: function (a, b) { for (var c = "", d = 0; d < a.length; d++) { var e = a[d]; c += "<li class='country " + b + "' data-dial-code='" + e.dialCode + "' data-country-code='" + e.iso2 + "'>", c += "<div class='flag-box'><div class='iti-flag " + e.iso2 + "'></div></