PageSourceSearch

https://representclo.com/cdn/shop/t/168/assets/localization-form.js?v=138154622050518409921781525322

js representclo.com collected 2026-10-02 02:24:26 UTC 8,558 bytes, 2 lines download raw bytes

1class LocalizationForm extends HTMLElement{constructor(){super(),this.shippingToDefaultSlot=this.querySelector('slot[name="shipping-to-default"]'),this.shippingToSelectedSlot=this.querySelector('slot[name="shipping-to-selected"]'),this.shippingToButton=this.querySelector("#shipping-location-btn"),this.shippingToSelect=this.querySelector("#shipping-location-select"),this.languageRadioTemplate=this.querySelector("#language-radio"),this.localesSlot=this.querySelector('slot[name="locales"]'),this.returnToElement=this.querySelector('input[name="return_to"]'),this.currencySymbolMap={},Object.entries(CURRENCY_CONFIGURATION).forEach(([handle,configuration])=>{this.currencySymbolMap[configuration.currency_iso_code]=configuration.currency_symbol}),this.regionNames=new Intl.DisplayNames(["en"],{type:"region"}),this.shippingToSelectedOrigText=this.shippingToSelectedSlot.textContent,this.clientLocale=window.navigator.language.split("-")[0],this.initialState={countryCode:this.shippingToSelect.dataset.selected,localeCode:this.localesSlot.querySelector('input[name="locale_code"]:checked')?.value}
1,this.blacklistedUrls=this.getAttribute("blacklisted-urls")?.split(",").map(url=>url.trim())||[],this.redirectUrl=this.getAttribute("redirect-url")||"",this.currentState=Object.assign({},this.initialState),this.initChosenLanguage(),this.handleRadioChange=function(e){this.currentState.localeCode=e.currentTarget.value,this.updateReturnTo(this.returnToElement.value,{language:this.currentState.localeCode})},this.handleRadioChangeHandler=this.handleRadioChange.bind(this),this.bindRadioEvents(),this.shippingToSelect.addEventListener("change",e=>this.handleShippingCountryChange(e.currentTarget.options[e.currentTarget.options.selectedIndex].id)),this.shippingToButton&&"showPicker"in this.shippingToSelect&&this.shippingToButton.addEventListener("click",e=>{e.preventDefault(),this.shippingToSelect.showPicker()}),this.querySelector("form").addEventListener("submit",this.handleSubmit.bind(this)),window.addEventListener("product:change",e=>this.handleProductChange(e)),this.shippingToSelectedSlot.style.display="none",this.updateSelectInput(this.currentState.countryCode);const clientLanguageElement=this.localesSlot.querySelector(`#language-${this.clientLocale}`);this.clientLocale!==Shopify.locale&&clientLanguageElement&&(Array.from(this.localesSlot.children).forEach(element=>element.classList.remove("order-first")),clientLanguageElement.checked=!0,clientLanguageElement.parentElement.classList.add("order-first"),this.currentState.localeCode=this.clientLocale),this.querySelectorAll('slot[name="shipping-location-country"]').forEach(slot=>{slot.textContent=this.regionNames.of(this.currentState.countryCode)}
1),this.blacklistedUrls.includes(this.returnToElement.value)&&(this.returnToElement.value=this.redirectUrl),this.updateReturnTo(this.returnToElement.value,{language:this.currentState.localeCode}),this.chosenLocale===Shopify.locale&&this.selectLanguage(this.chosenLocale),this.updateSupportedLanguages(this.currentState.countryCode);const drawerId=this.getAttribute("drawer"),urlParams=new URLSearchParams(window.location.search);if(urlParams.get("drawer")===drawerId){const drawer=document.getElementById(drawerId);drawer&&drawer.show()}if(urlParams.get("suggestedCountry")){const suggestedCountry=urlParams.get("suggestedCountry");this.updateSelectInput(suggestedCountry),this.handleShippingCountryChange(suggestedCountry)}}updateSelectInput(countryCode){this.shippingToSelect.selectedIndex=Array.from(this.shippingToSelect.options).findIndex(option=>option.id===countryCode)}handleProductChange(e){this.updateReturnTo(`/products/${e.detail.product.handle}`,{language:this.currentState.localeCode})}handleShippingCountryChange(countryIsoCode){this.updateShippingToSelectedSlot(countryIsoCode),this.updateSupportedLanguages(countryIsoCode),this.updateState(countryIsoCode),this.updateFormData(countryIsoCode),this.bindRadioEvents()}handleSubmit(e){const country=this.shippingToSelect.options[this.shippingToSelect.selectedIndex].id;window.countryNav.suppressWrongSitePopup(country)}updateState(countryIsoCode){this.currentState.countryCode=countryIsoCode,this.currentState.localeCode=this.localesSlot.querySelector('input[name="locale_code"]:checked').value}updateShippingToSelectedSlot(countryIsoCode){const foundCurrencyCountry=Object.entries(window.currencyCountryMap).find(([currencyCode,countries])=>countries.includes(countryIsoCode));if(!foundCurrencyCountry)throw new Error("No currency code found for country: "+countryIsoCode);const[currencyIsoCode,currencySymbol]=foundCurrencyCountry,shortcodes={__COUNTRY__:this.regionNames.of(countryIsoCode),__CURRENCY_ISO_CODE__:currencyIsoCode,__CURRENCY_SYMBOL__:this.currencySymbolMap[currencyIsoCode]};let shippingToSelectedText=this.shippingToSelectedOrigText;Object.entries(shortcodes).forEach(([shortcode,value])=>{shippingToSelectedText=shippingToSelectedText.replace(shortcode,value)}),this.shippingToSelectedSlot.textContent=shippingToSelectedText,this.shippingToDefaultSlot.style.display="none",this.shippingToSelectedSlot.style.display="block",this.querySelectorAll('slot[name="shipping-location-country"]').forEach(slot=>{slot.textContent=this.regionNames.of(countryIsoCode)})}updateSupportedLanguages(countryIsoCode){const languageCodes=Object.entries(window.supportedLanguages).filter(([languageCode,countries])=>countries.includes(countryIsoCode)).map(([languageCode])=>languageCode);Array.from(this.localesSlot.children).filter(element=>!languageCodes.includes(element.querySelector('input[name="locale_code"]').value)).forEach(languageToRemove=>languageToRemove.remove()),languageCodes.forEach(languageCode=>{const hasLanguageElement=this.localesSlot.querySelector(`#language-${languageCode}`);if(hasLanguageElement){hasLanguageElement.closest("label")?.classList.remove("order-first");return}const languageNames=new Intl.DisplayNames([languageCode],{type:"language"}),templateContent=this.languageRadioTemplate.content.cloneNode(!0),item=templateContent.querySelector("label"),radioLabel=item.querySelector('[data-template="language-label"]'),radio=item.querySelector('input[name="locale_code"]');radio.id=`language-${languageCode}`,radio.value=languageCode,this.chosenLocale===languageCode||this.clientLocale===languageCode||Shopify.locale===languageCode?(radio.checked=!0,item.classList.add("order-first")):(radio.checked=!1,item.classList.remove("order-first")),radioLabel.textContent=languageNames.of(languageCode),radioLabel.removeAttribute("data-template"),this.localesSlot.appendChild(templateContent)});const hasCheckedInput=!!this.localesSlot.querySelector('input[name="locale_code"]:checked');(this.localesSlot.children.length===1||!hasCheckedInput)&&(this.localesSlot.children[0].querySelector('input[name="locale_code"]').checked=!0)}selectLanguage(languageCode){const selectedElement=Array.from(this.localesSlot.children).find(element=>element.querySelector('input[name="locale_code"]').value===languageCode);
1selectedElement&&(Array.from(this.localesSlot.children).forEach(element=>element.classList.remove("order-first")),selectedElement.classList.add("order-first"),selectedElement.querySelector('input[name="locale_code"]').checked=!0)}updateFormData(countryIsoCode){const selectedOption=this.shippingToSelect.querySelector(`#${countryIsoCode}`);this.querySelector("form").setAttribute("action",`${selectedOption.value}/localization`),this.querySelector('input[name="country_code"]').value=countryIsoCode,this.updateReturnTo(this.returnToElement.value,{language:this.currentState.localeCode})}updateReturnTo(url,params={}){const urlObject=new URL(url,window.location.origin);urlObject.searchParams.delete("drawer"),urlObject.searchParams.delete("suggestedCountry"),this.returnToElement.value=window.updateQueryParams(urlObject.pathname,params)}bindRadioEvents(){this.localesSlot.querySelectorAll("input").forEach(input=>{input.removeEventListener("change",this.handleRadioChangeHandler),input.addEventListener("change",this.handleRadioChangeHandler)})}hasStateChanged(){return JSON.stringify(this.initialState)!==JSON.stringify(this.currentState)}initChosenLanguage(){let localeCode=new URLSearchParams(window.location.href.split("?")[1]).get("language");localeCode?cookies.setCookie("rep_chosen_language",localeCode):localeCode=cookies.getCookie("rep_chosen_language"),this.chosenLocale=localeCode}}customElements.define("localization-form",LocalizationForm);
2//# sourceMappingURL=/cdn/shop/t/168/assets/localization-form.js.map?v=138154622050518409921781525322

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.