- Your IP: 216.73.216.124
- Server IP: 50.28.103.30
- Server: Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
- Server Software: nginx/1.28.0
- PHP Version: 8.3.12
-
Buat File |
Buat Folder
Edit File: combined_js_entry_page_libraries.js
")}
content+="".concat(c.name,"");content+="+".concat(c.dialCode,"");listItem.insertAdjacentHTML("beforeend",content)}}},{key:"_setInitialState",value:function _setInitialState(){var attributeValue=this.telInput.getAttribute("value");var inputValue=this.telInput.value;var useAttribute=attributeValue&&attributeValue.charAt(0)==="+"&&(!inputValue||inputValue.charAt(0)!=="+");var val=useAttribute?attributeValue:inputValue;var dialCode=this._getDialCode(val);var isRegionlessNanp=this._isRegionlessNanp(val);var _this$options2=this.options,initialCountry=_this$options2.initialCountry,autoInsertDialCode=_this$options2.autoInsertDialCode;if(dialCode&&!isRegionlessNanp){this._updateFlagFromNumber(val)}else if(initialCountry!=="auto"){var isValidInitialCountry=initialCountry&&this._getCountryData(initialCountry,!1,!0);if(isValidInitialCountry){this._setFlag(initialCountry.toLowerCase())}else{if(dialCode&&isRegionlessNanp){this._setFlag("us")}else{this.defaultCountry=this.preferredCountries.length?this.preferredCountries[0].iso2:this.countries[0].iso2;if(!val){this._setFlag(this.defaultCountry)}}}
if(!val&&autoInsertDialCode){this.telInput.value="+".concat(this.selectedCountryData.dialCode)}}
if(val){this._updateValFromNumber(val)}}},{key:"_initListeners",value:function _initListeners(){this._initKeyListeners();if(this.options.autoInsertDialCode){this._initBlurListeners()}
if(this.options.allowDropdown){this._initDropdownListeners()}
if(this.hiddenInput){this._initHiddenInputListener()}}},{key:"_initHiddenInputListener",value:function _initHiddenInputListener(){var _this2=this;this._handleHiddenInputSubmit=function(){_this2.hiddenInput.value=_this2.getNumber()};if(this.telInput.form){this.telInput.form.addEventListener("submit",this._handleHiddenInputSubmit)}}},{key:"_initDropdownListeners",value:function _initDropdownListeners(){var _this3=this;this._handleLabelClick=function(e){if(_this3.dropdownContent.classList.contains("iti__hide")){_this3.telInput.focus()}else{e.preventDefault()}};var label=this.telInput.closest("label");if(label){label.addEventListener("click",this._handleLabelClick)}
this._handleClickSelectedFlag=function(){if(_this3.dropdownContent.classList.contains("iti__hide")&&!_this3.telInput.disabled&&!_this3.telInput.readOnly){_this3._showDropdown()}};this.selectedFlag.addEventListener("click",this._handleClickSelectedFlag);this._handleFlagsContainerKeydown=function(e){var isDropdownHidden=_this3.dropdownContent.classList.contains("iti__hide");if(isDropdownHidden&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)){e.preventDefault();e.stopPropagation();_this3._showDropdown()}
if(e.key==="Tab"){_this3._closeDropdown()}};this.flagsContainer.addEventListener("keydown",this._handleFlagsContainerKeydown)}},{key:"_initRequests",value:function _initRequests(){var _this4=this;if(this.options.utilsScript&&!window.intlTelInputUtils){if(window.intlTelInputGlobals.documentReady()){window.intlTelInputGlobals.loadUtils(this.options.utilsScript)}else{window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(_this4.options.utilsScript)})}}else{this.resolveUtilsScriptPromise()}
if(this.options.initialCountry==="auto"){this._loadAutoCountry()}else{this.resolveAutoCountryPromise()}}},{key:"_loadAutoCountry",value:function _loadAutoCountry(){if(window.intlTelInputGlobals.autoCountry){this.handleAutoCountry()}else if(!window.intlTelInputGlobals.startedLoadingAutoCountry){window.intlTelInputGlobals.startedLoadingAutoCountry=!0;if(typeof this.options.geoIpLookup==="function"){this.options.geoIpLookup(function(countryCode){window.intlTelInputGlobals.autoCountry=countryCode.toLowerCase();setTimeout(function(){return forEachInstance("handleAutoCountry")})},function(){return forEachInstance("rejectAutoCountryPromise")})}}}},{key:"_initKeyListeners",value:function _initKeyListeners(){var _this5=this;var userOverrideFormatting=!1;this._handleKeyEvent=function(e){if(_this5._updateFlagFromNumber(_this5.telInput.value)){_this5._triggerCountryChange()}
if(e&&e.data&&/[^+0-9]/.test(e.data)){userOverrideFormatting=!0}else if(!/[^+0-9]/.test(_this5.telInput.value)){userOverrideFormatting=!1}
if(_this5.options.formatAsYouType&&!userOverrideFormatting){var currentCaretPos=_this5.telInput.selectionStart;var valueBeforeCaret=_this5.telInput.value.substring(0,currentCaretPos);var relevantCharsBeforeCaret=valueBeforeCaret.replace(/[^+0-9]/g,"").length;var isDeleteForwards=e&&e.inputType==="deleteContentForward";var formattedValue=_this5._formatNumberAsYouType();var newCaretPos=_this5._translateCursorPosition(relevantCharsBeforeCaret,formattedValue,currentCaretPos,isDeleteForwards);_this5.telInput.value=formattedValue;_this5.telInput.setSelectionRange(newCaretPos,newCaretPos)}};this.telInput.addEventListener("input",this._handleKeyEvent);this._handleClipboardEvent=function(){setTimeout(_this5._handleKeyEvent)};this.telInput.addEventListener("cut",this._handleClipboardEvent);this.telInput.addEventListener("paste",this._handleClipboardEvent)}},{key:"_translateCursorPosition",value:function _translateCursorPosition(relevantChars,formattedValue,prevCaretPos,isDeleteForwards){if(prevCaretPos===0&&!isDeleteForwards){return 0}
var count=0;for(var i=0;imax?number.substr(0,max):number}},{key:"_initBlurListeners",value:function _initBlurListeners(){var _this6=this;this._handleSubmitOrBlurEvent=function(){_this6._removeEmptyDialCode()};if(this.telInput.form){this.telInput.form.addEventListener("submit",this._handleSubmitOrBlurEvent)}
this.telInput.addEventListener("blur",this._handleSubmitOrBlurEvent)}},{key:"_removeEmptyDialCode",value:function _removeEmptyDialCode(){if(this.telInput.value.charAt(0)==="+"){var numeric=this._getNumeric(this.telInput.value);if(!numeric||this.selectedCountryData.dialCode===numeric){this.telInput.value=""}}}},{key:"_getNumeric",value:function _getNumeric(s){return s.replace(/\D/g,"")}},{key:"_trigger",value:function _trigger(name){var e=new Event(name,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}},{key:"_showDropdown",value:function _showDropdown(){if(this.options.fixDropdownWidth){this.dropdownContent.style.width="".concat(this.telInput.offsetWidth,"px")}
this.dropdownContent.classList.remove("iti__hide");this.selectedFlag.setAttribute("aria-expanded","true");this._setDropdownPosition();if(this.options.countrySearch){var firstElementChild=this.countryList.firstElementChild;if(firstElementChild){this._highlightListItem(firstElementChild,!1)}
this.searchInput.focus()}else if(this.activeItem){this._highlightListItem(this.activeItem,!1);this._scrollTo(this.activeItem,!0)}
this._bindDropdownListeners();this.dropdownArrow.classList.add("iti__arrow--up");this._trigger("open:countrydropdown")}},{key:"_toggleClass",value:function _toggleClass(el,className,shouldHaveClass){if(shouldHaveClass&&!el.classList.contains(className)){el.classList.add(className)}else if(!shouldHaveClass&&el.classList.contains(className)){el.classList.remove(className)}}},{key:"_setDropdownPosition",value:function _setDropdownPosition(){var _this7=this;if(this.options.dropdownContainer){this.options.dropdownContainer.appendChild(this.dropdown)}
if(!this.options.useFullscreenPopup){var pos=this.telInput.getBoundingClientRect();var windowTop=document.documentElement.scrollTop;var inputTop=pos.top+windowTop;var dropdownHeight=this.dropdownContent.offsetHeight;var dropdownFitsBelow=inputTop+this.telInput.offsetHeight+dropdownHeightwindowTop;var positionDropdownAboveInput=!this.options.countrySearch&&!dropdownFitsBelow&&dropdownFitsAbove;this._toggleClass(this.dropdownContent,"iti__dropdown-content--dropup",positionDropdownAboveInput);if(this.options.dropdownContainer){var extraTop=positionDropdownAboveInput?0:this.telInput.offsetHeight;this.dropdown.style.top="".concat(inputTop+extraTop,"px");this.dropdown.style.left="".concat(pos.left+document.body.scrollLeft,"px");this._handleWindowScroll=function(){return _this7._closeDropdown()};window.addEventListener("scroll",this._handleWindowScroll)}}}},{key:"_bindDropdownListeners",value:function _bindDropdownListeners(){var _this8=this;this._handleMouseoverCountryList=function(e){var listItem=e.target.closest(".iti__country");if(listItem){_this8._highlightListItem(listItem,!1)}};this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList);this._handleClickCountryList=function(e){var listItem=e.target.closest(".iti__country");if(listItem){_this8._selectListItem(listItem)}};this.countryList.addEventListener("click",this._handleClickCountryList);var isOpening=!0;this._handleClickOffToClose=function(){if(!isOpening){_this8._closeDropdown()}
isOpening=!1};document.documentElement.addEventListener("click",this._handleClickOffToClose);var query="";var queryTimer=null;this._handleKeydownOnDropdown=function(e){if(["ArrowUp","ArrowDown","Enter","Escape"].includes(e.key)){e.preventDefault();e.stopPropagation();if(e.key==="ArrowUp"||e.key==="ArrowDown"){_this8._handleUpDownKey(e.key)}else if(e.key==="Enter"){_this8._handleEnterKey()}else if(e.key==="Escape"){_this8._closeDropdown()}}
if(!_this8.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)){e.stopPropagation();if(queryTimer){clearTimeout(queryTimer)}
query+=e.key.toLowerCase();_this8._searchForCountry(query);queryTimer=setTimeout(function(){query=""},1e3)}};document.addEventListener("keydown",this._handleKeydownOnDropdown);if(this.options.countrySearch){var doFilter=function doFilter(){var inputQuery=_this8.searchInput.value.trim();if(inputQuery){_this8._filterCountries(inputQuery)}else{_this8._filterCountries("",!0)}};var keyupTimer=null;this._handleSearchChange=function(){if(keyupTimer){clearTimeout(keyupTimer)}
keyupTimer=setTimeout(function(){doFilter();keyupTimer=null},100)};this.searchInput.addEventListener("input",this._handleSearchChange);this.searchInput.addEventListener("click",function(e){return e.stopPropagation()})}}},{key:"_normaliseString",value:function _normaliseString(){var s=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";return s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},{key:"_filterCountries",value:function _filterCountries(query){var isReset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var isFirst=!0;this.countryList.innerHTML="";var normalisedQuery=this._normaliseString(query);for(var i=0;i1){next=key==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild}
if(next){var doFocus=!this.options.countrySearch;this._highlightListItem(next,doFocus);if(this.options.countrySearch){this._scrollTo(next,!1)}}}},{key:"_handleEnterKey",value:function _handleEnterKey(){if(this.highlightedItem){this._selectListItem(this.highlightedItem)}}},{key:"_searchForCountry",value:function _searchForCountry(query){for(var i=0;icontainerBottom){if(middle){newScrollTop+=middleOffset}
var heightDifference=containerHeight-elementHeight;container.scrollTop=newScrollTop-heightDifference}}},{key:"_updateDialCode",value:function _updateDialCode(newDialCodeBare){var inputVal=this.telInput.value;var newDialCode="+".concat(newDialCodeBare);var newNumber;if(inputVal.charAt(0)==="+"){var prevDialCode=this._getDialCode(inputVal);if(prevDialCode){newNumber=inputVal.replace(prevDialCode,newDialCode)}else{newNumber=newDialCode}
this.telInput.value=newNumber}else if(this.options.autoInsertDialCode){if(inputVal){newNumber=newDialCode+inputVal}else{newNumber=newDialCode}
this.telInput.value=newNumber}}},{key:"_getDialCode",value:function _getDialCode(number,includeAreaCode){var dialCode="";if(number.charAt(0)==="+"){var numericChars="";for(var i=0;i