From 533a4d46736b8588a02793698b9b88a8d882ddec Mon Sep 17 00:00:00 2001 From: Danny Kirschner Date: Fri, 5 May 2023 10:11:28 -0400 Subject: [PATCH 1/3] 1415: flag container title attribute updates - when separateDialCode is enabled, removes dial code from title closes https://github.com/jackocnr/intl-tel-input/issues/1415 --- src/js/intlTelInput.js | 38 +++++++++++++++++------- src/spec/tests/methods/setCountry.js | 44 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/src/js/intlTelInput.js b/src/js/intlTelInput.js index c2b3204cf..79b340133 100644 --- a/src/js/intlTelInput.js +++ b/src/js/intlTelInput.js @@ -1166,9 +1166,11 @@ class Iti { throw new Error(`No country data for '${countryCode}'`); } - // select the given flag, update the placeholder and the active list item + // select the given flag, update the placeholder, title, and the active list item // Note: called from _setInitialState, _updateFlagFromNumber, _selectListItem, setCountry _setFlag(countryCode) { + const { allowDropdown, separateDialCode, showFlags } = this.options; + const prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; @@ -1182,21 +1184,16 @@ class Iti { this.defaultCountry = this.selectedCountryData.iso2; } - if (this.options.showFlags) { + if (showFlags) { this.selectedFlagInner.setAttribute( "class", `iti__flag iti__${countryCode}` ); } - // update the selected country's title attribute - if (this.selectedFlag) { - const title = countryCode - ? `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` - : "Unknown"; - this.selectedFlag.setAttribute("title", title); - } - if (this.options.separateDialCode) { + this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode); + + if (separateDialCode) { const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : ""; @@ -1213,7 +1210,7 @@ class Iti { this._updatePlaceholder(); // update the active list item - if (this.options.allowDropdown) { + if (allowDropdown) { const prevItem = this.activeItem; if (prevItem) { prevItem.classList.remove("iti__active"); @@ -1238,6 +1235,25 @@ class Iti { return prevCountry.iso2 !== countryCode; } + _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) { + if (!this.selectedFlag) { + return; + } + + let title; + if (countryCode && !separateDialCode) { + title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`; + } else if (countryCode) { + // For screen reader output, we don't want to include the dial code in the reader output twice + // so just use the selected country name here: + title = this.selectedCountryData.name; + } else { + title = "Unknown"; + } + + this.selectedFlag.setAttribute("title", title); + } + // when the input is in a hidden container during initialisation, we must inject some markup // into the end of the DOM to calculate the correct offsetWidth // NOTE: this is only used when separateDialCode is enabled, so flagsContainer and selectedFlag diff --git a/src/spec/tests/methods/setCountry.js b/src/spec/tests/methods/setCountry.js index 0bef4d1df..975c51011 100644 --- a/src/spec/tests/methods/setCountry.js +++ b/src/spec/tests/methods/setCountry.js @@ -23,4 +23,48 @@ describe("setCountry: init plugin and calling public method setCountry()", funct expect(getInputVal()).toEqual(""); }); + describe("setting title attribute on flag container", function() { + describe("when separateDialCode is false", function() { + beforeEach(function() { + iti = window.intlTelInput(input[0], { + showFlags: true, + separateDialCode: false, + }); + iti.setCountry(countryCode); + }); + + it("has the country name and dial code in the flag's title", function() { + expect(getSelectedFlagContainer().attr("title")).toEqual("United Kingdom: +44"); + }); + }); + + describe("when separateDialCode is true", function() { + beforeEach(function() { + iti = window.intlTelInput(input[0], { + showFlags: true, + separateDialCode: true, + }); + iti.setCountry(countryCode); + }); + + it("has the country name but not the dial code in the flag's title", function() { + expect(getSelectedFlagContainer().attr("title")).toEqual("United Kingdom"); + }); + }); + + + // setCountry errors out when country code is undefined, so we can likely remove this scenario and make country code a required param + describe("when countryCode is falsey", function() { + // beforeEach(function() { + // iti = window.intlTelInput(input[0], { + // showFlags: true, + // }); + // iti.setCountry(); + // }); + + it("sets the flag's title as Unknown", function() { + // expect(getSelectedFlagContainer().attr("title")).toEqual("Unknown"); + }); + }) + }); }); From fa5e32c8743795f1f9cbf328fe6212110a532981 Mon Sep 17 00:00:00 2001 From: Danny Kirschner Date: Fri, 5 May 2023 11:54:20 -0400 Subject: [PATCH 2/3] 1419 - fixes screen reader not reading select box option closes https://github.com/jackocnr/intl-tel-input/issues/1419 --- src/js/intlTelInput.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/intlTelInput.js b/src/js/intlTelInput.js index 79b340133..1819b1292 100644 --- a/src/js/intlTelInput.js +++ b/src/js/intlTelInput.js @@ -412,7 +412,6 @@ class Iti { role: "combobox", "aria-haspopup": "listbox", "aria-controls": `iti-${this.id}__country-listbox`, - "aria-owns": `iti-${this.id}__country-listbox`, "aria-expanded": "false", "aria-label": "Telephone country code" }) From 1d4580c6c8e325fb37c7f058d48e6ac6041521f3 Mon Sep 17 00:00:00 2001 From: Danny Kirschner Date: Mon, 15 May 2023 10:27:16 -0400 Subject: [PATCH 3/3] built the JS --- build/js/intlTelInput-jquery.js | 32 +++++++++++++++++++++-------- build/js/intlTelInput-jquery.min.js | 4 ++-- build/js/intlTelInput.js | 32 +++++++++++++++++++++-------- build/js/intlTelInput.min.js | 4 ++-- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/build/js/intlTelInput-jquery.js b/build/js/intlTelInput-jquery.js index bc91b27de..c0b18b5c1 100644 --- a/build/js/intlTelInput-jquery.js +++ b/build/js/intlTelInput-jquery.js @@ -456,7 +456,6 @@ role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), - "aria-owns": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": "Telephone country code" }), this.flagsContainer); @@ -1079,6 +1078,7 @@ }, { key: "_setFlag", value: function _setFlag(countryCode) { + var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags; var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; // do this first as it will throw an error and stop if countryCode is invalid this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; @@ -1086,15 +1086,11 @@ if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } - if (this.options.showFlags) { + if (showFlags) { this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode)); } - // update the selected country's title attribute - if (this.selectedFlag) { - var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown"; - this.selectedFlag.setAttribute("title", title); - } - if (this.options.separateDialCode) { + this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode); + if (separateDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : ""; this.selectedDialCode.innerHTML = dialCode; // offsetWidth is zero if input is in a hidden container during initialisation @@ -1105,7 +1101,7 @@ // and the input's placeholder this._updatePlaceholder(); // update the active list item - if (this.options.allowDropdown) { + if (allowDropdown) { var prevItem = this.activeItem; if (prevItem) { prevItem.classList.remove("iti__active"); @@ -1122,6 +1118,24 @@ // return if the flag has changed or not return prevCountry.iso2 !== countryCode; } + }, { + key: "_setSelectedCountryFlagTitleAttribute", + value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) { + if (!this.selectedFlag) { + return; + } + var title; + if (countryCode && !separateDialCode) { + title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode); + } else if (countryCode) { + // For screen reader output, we don't want to include the dial code in the reader output twice + // so just use the selected country name here: + title = this.selectedCountryData.name; + } else { + title = "Unknown"; + } + this.selectedFlag.setAttribute("title", title); + } }, { key: "_getHiddenSelectedFlagWidth", value: function _getHiddenSelectedFlagWidth() { diff --git a/build/js/intlTelInput-jquery.min.js b/build/js/intlTelInput-jquery.min.js index 444d4905a..12b447a65 100644 --- a/build/js/intlTelInput-jquery.min.js +++ b/build/js/intlTelInput-jquery.min.js @@ -4,5 +4,5 @@ * Licensed under the MIT license */ -!function(a){"object"==typeof module&&module.exports?module.exports=a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):a(jQuery)}(function(a,b){"use strict";function c(a){for(var b=1;bthis.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=j.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=j}},{key:"_d0",value:function(){for(var a=0;ab.name?1:0}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a"),this.d.showFlags&&(d+="
")),d+="".concat(f.name,""),d+="+".concat(f.dialCode,""),d+=""}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.getAttribute("value"),b=this.a.value,c=a&&"+"===a.charAt(0)&&(!b||"+"!==b.charAt(0)),d=c?a:b,e=this._5(d),f=this._w(d),g=this.d,h=g.initialCountry,i=g.autoInsertDialCode;e&&!f?this._v(d):"auto"!==h&&(h?this._z(h.toLowerCase()):e&&f?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,d||this._z(this.j)),!d&&i&&(this.a.value="+".concat(this.s.dialCode))),d&&this._u(d)}},{key:"_i",value:function(){this._j(),this.d.autoInsertDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return r("handleAutoCountry")})},function(){return r("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+ec;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;bg){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}else this.d.autoInsertDialCode&&(b=c?d+c:d,this.a.value=b)}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;ethis.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=j.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=j}},{key:"_d0",value:function(){for(var a=0;ab.name?1:0}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a"),this.d.showFlags&&(d+="
")),d+="".concat(f.name,""),d+="+".concat(f.dialCode,""),d+=""}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.getAttribute("value"),b=this.a.value,c=a&&"+"===a.charAt(0)&&(!b||"+"!==b.charAt(0)),d=c?a:b,e=this._5(d),f=this._w(d),g=this.d,h=g.initialCountry,i=g.autoInsertDialCode;e&&!f?this._v(d):"auto"!==h&&(h?this._z(h.toLowerCase()):e&&f?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,d||this._z(this.j)),!d&&i&&(this.a.value="+".concat(this.s.dialCode))),d&&this._u(d)}},{key:"_i",value:function(){this._j(),this.d.autoInsertDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return r("handleAutoCountry")})},function(){return r("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+ec;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;bg){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}else this.d.autoInsertDialCode&&(b=c?d+c:d,this.a.value=b)}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e