PageSourceSearch

https://moshimoshimind.com/cdn/shop/t/13/assets/geo.js?v=55802882670838843241738735535

js moshimoshimind.com collected 2026-10-02 05:01:26 UTC 10,671 bytes, 2 lines download raw bytes

1function setCookie({name,value,days}){const date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);const expires=`; expires=${date.toUTCString()}`;document.cookie=`${name}=${value}; ${expires}; path=/`}function getCookie({name}){const nameEQ=`${name}=`,ca=document.cookie.split(";");for(let i=0;i<ca.length;i++){let c=ca[i];for(;c.charAt(0)==" ";)c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)}return null}function tryFetchUrl({url}){return new Promise(resolve=>{fetch(url).then(response=>{if(!response.ok)throw err}).then(()=>{resolve(!0)}).catch(()=>{resolve(!1)})})}async function validateUrl({currentUrl,redirectUrl}){const jsonUrl=`${redirectUrl.origin+currentUrl.pathname}.json`;await tryFetchUrl({url:jsonUrl})?window.location.href=redirectUrl.origin+currentUrl.pathname:window.location.href=redirectUrl.origin}function redirectToSamePath({url}){const currentUrl=new URL(window.location.href);url.charAt(0)==="/"&&(url=window.location.href+url);let redirectUrl=new URL(url);currentUrl.path==="/"&&(window.location.href=redirectUrl.origin),validateUrl({currentUrl,redirectUrl})}function populateStoreElem({htmlTemplate,storeData,settings}){if(htmlTemplate&&storeData&&settings){const htmlTemplateImg=htmlTemplate.querySelector("[data-store-image]"),htmlTemplateText=htmlTemplate.querySelector("[data-store-title]");switch(storeData.link&&(htmlTemplate.setAttribute("href",storeData.link),htmlTemplate.addEventListener("click",event=>{event.preventDefault(),redirectToSamePath({url:storeData.link})})),htmlTemplate.setAttribute("title",storeData.title),storeData.highlight!==null&&storeData.highlight===!0&&htmlTemplate.classList.add("highlight"),settings.showImage&&storeData.imageSrc?(htmlTemplateImg.setAttribute("src",storeData.imageSrc),htmlTemplateImg.setAttribute("alt",storeData.title),settings.lazyLoadImage?htmlTemplateImg.setAttribute("loading","lazy"):new Image().src=storeData.imageSrc):htmlTemplateImg.remove(),settings.showTitle){case"title":htmlTemplateText.innerText=storeData.title;break;case"dropdown_title":htmlTemplateText.innerText=storeData.dropdownTitle;break;case"country_code":storeData.countryCodes.length>0?htmlTemplateText.innerText=storeData.countryCodes[0]:storeData.title?htmlTemplateText.innerText=storeData.title:htmlTemplateText.innerText=storeData.dropdownTitle;break;default:htmlTemplateText.remove();break}return htmlTemplate}else return null}class GeoPopup{constructor(main,data,geoData,forceOpen){this.data={countryCode:data.country_code,continentCode:data.continent_code,stores:data.stores,currentStore:data.stores.find(x=>x.isCurrentStore==!0),externalStores:data.stores.filter(x=>x.isCurrentStore==!1),geo:geoData},this.settings=data.popupSettings,this.forceOpen=forceOpen,this.dom={popup:main,headline:main.querySelector('[data-template="headline"]'),subheading:main.querySelector('[data-template="subheading"]'),currentStoreTemplate:main.querySelector('[data-template="current-store"]'),externalStoreTemplate:main.querySelector('[data-template="external-store"]'),externalStoresContainer:main.querySelector('[data-template="stores-container"]'),fragment:document.createDocumentFragment()},this.init()}init(){if(this.data.storeMatch=this.getStoreMatch(),this.data.storeMatch&&this.data.storeMatch!=null){if(this.data.storeMatch.isCurrentStore===!0&&this.forceOpen===!1)return setCookie({name:"geoDismissed",value:1,days:30});this.forceOpen=!0,this.build({hasMatch:!0})}else this.build({})}build({hasMatch=!1}){this.setHeadline({hasMatch}),this.imageSettings(),hasMatch&&this.geoMatchSettings(),this.addCurrentStoreToPopup(),this.addExternalStoresToPopup(),this.attacheListeners(),this.forceOpen===!0&&this.openPopup()}getStoreMatch(){if(!this.data.geo)return null;if(this.data.stores.some(x=>x.countryCodes.includes(this.data.geo.country_code)))return this.data.stores.find(x=>x.countryCodes.includes(this.data.geo.country_code));if(this.data.stores.some(x=>x.countryCodes.includes(this.data.geo.continent_code)))return this.data.stores.find(x=>x.countryCodes.includes(this.data.geo.continent_code));if(this.data.stores.some(x=>x.isInternational==!0))return this.data.stores.find(x=>x.isInternational==!0)}setHeadline({hasMatch}){hasMatch&&this.data.storeMatch.popup.headline&&this.data.storeMatch.popup.subheading?(this.dom.headline.innerText=this.data.storeMatch.popup.headline,this.dom.subheading.innerText=this.data.storeMatch.popup.subheading):(this.dom.headline.innerText=this.data.currentStore.popup.headline,this.dom.subheading.innerText=this.data.currentStore.popup.subheading)}imageSettings(){this.settings.imagePosition==="right"&&this.dom.popup.classList.add("image-position--right"),this.settings.roundedImages&&this.dom.popup.classList.add("images--rounded"),this.settings.showLanguageTitle==="none"&&this.dom.popup.classList.add("images--only")}geoMatchSettings(){switch(this.settings.geoMatch){case"highlight":const index=this.data.externalStores.findIndex(x=>x===this.data.storeMatch);index>=0&&(this.data.externalStores[index].highlight=!0);break;case"matchOnly":this.data.storeMatch&&(this.data.externalStores=[this.data.externalStores.find(x=>x===this.data.storeMatch)]);break}}addCurrentStoreToPopup(){this.dom.currentStoreTemplate&&populateStoreElem({htmlTemplate:this.dom.currentStoreTemplate,storeData:this.data.currentStore,settings:{showTitle:this.settings.showLanguageTitle,showImage:this.settings.showImages,lazyLoadImage:!1}})}addExternalStoresToPopup(){this.dom.externalStoreTemplate&&(this.data.externalStores.forEac
1h(externalStore=>{const template=this.dom.externalStoreTemplate.cloneNode(!0);this.dom.fragment.appendChild(populateStoreElem({htmlTemplate:template,storeData:externalStore,settings:{showTitle:this.settings.showLanguageTitle,showImage:this.settings.showImages,lazyLoadImage:!1}}))}),this.dom.externalStoreTemplate.remove(),this.dom.externalStoresContainer.appendChild(this.dom.fragment))}attacheListeners(){this.dom.popup.querySelectorAll('[data-action="close"]').forEach(closeElement=>{closeElement.addEventListener("click",()=>{this.closePopup({setCookieValue:!1})})}),this.dom.popup.querySelectorAll('[data-action="dismiss"]').forEach(closeElement=>{closeElement.addEventListener("click",()=>{this.closePopup({setCookieValue:!0})})})}attacheCloseListeners(){this.dom.popup.querySelectorAll('[data-action="close"]').forEach(closeElement=>{closeElement.addEventListener("click",()=>{this.closePopup({setCookieValue:!1})})})}attacheDismissListeners(){this.dom.popup.querySelectorAll('[data-action="dismiss"]').forEach(closeElement=>{closeElement.addEventListener("click",()=>{this.closePopup({setCookieValue:!0})})})}openPopup(){this.dom.popup.classList.remove("hidden"),window.scrollLock.disablePageScroll()}closePopup({setCookieValue}){this.dom.popup.classList.add("hidden"),window.scrollLock.enablePageScroll(),setCookieValue&&setCookie({name:"geoDismissed",value:1,days:30})}}class GeoDropdown{constructor(main,storeData){storeData.stores&&(this.data={currentStore:storeData.stores.find(x=>x.isCurrentStore==!0),externalStores:storeData.stores.filter(x=>x.isCurrentStore==!1)}),storeData.dropdownSettings&&(this.settings=storeData.dropdownSettings),this.dom={fragment:document.createDocumentFragment(),dropdown:main,currentStoreHeaderElement:main.querySelector('[data-template="current-store-header"]'),currentStoreElement:main.querySelector('[data-template="current-store"]'),externalStoreElement:main.querySelector('[data-template="external-store"]'),storesContainer:main.querySelector('[data-template="stores-container"]'),openElements:main.querySelectorAll('[data-action="open"]'),closeElements:main.querySelectorAll('[data-action="close"]'),toggleElements:main.querySelectorAll('[data-action="toggle"]')},this.init(),this.error&&(this.dom.dropdown.style.display="none")}attacheEventliteners(){this.dom.openElements&&this.dom.openElements.forEach(openElement=>{openElement.addEventListener("click",()=>{this.openDropdown()})}),this.dom.closeElements&&this.dom.closeElements.forEach(closeElement=>{closeElement.addEventListener("click",()=>{this.closeDropdown()})}),this.dom.toggleElements&&this.dom.toggleElements.forEach(toggleElement=>{toggleElement.addEventListener("click",()=>{this.dom.dropdown.classList.contains("open")?this.closeDropdown():this.openDropdown()})}),document.addEventListener("click",event=>{var isClickInside=this.dom.dropdown.contains(event.target);isClickInside||this.closeDropdown()})}applySettings(){this.settings.imagePosition==="right"&&this.dom.dropdown.classList.add("image-position--right"),this.settings.roundedImages&&this.dom.dropdown.classList.add("images--rounded")}addCurrentStoreToDropdown(){this.data.currentStore&&(populateStoreElem({htmlTemplate:this.dom.currentStoreHeaderElement,storeData:this.data.currentStore,settings:{showTitle:this.settings.showLanguageTitleInHeader,showImage:this.settings.showImages,lazyLoadImage:!1,isDropdown:!0}}),populateStoreElem({htmlTemplate:this.dom.currentStoreElement,storeData:this.data.currentStore,settings:{showTitle:this.settings.showLanguageTitleInContent,showImage:this.settings.showImages,lazyLoadImage:!0,isDropdown:!0}}))}addExternalStoresToDropdown(){this.data.externalStores&&this.data.externalStores.forEach(externalStore=>{const template=this.dom.externalStoreElement.cloneNode(!0);this.dom.fragment.appendChild(populateStoreElem({htmlTemplate:template,storeData:externalStore,settings:{showTitle:this.settings.showLanguageTitleInContent,showImage:this.settings.showImages,lazyLoadImage:!0,isDropdown:!0}}))}),this.dom.externalStoreElement.remove(),this.dom.storesContainer.appendChild(this.dom.fragment)}init(){this.attacheEventliteners(),this.applySettings(),this.addCurrentStoreToDropdown(),this.addExternalStoresToDropdown()}openDropdown(){this.settings.openDropdownAsPopup===!0?window.geoPopup?window.geoPopup.openPopup():initGeoPopup({forceOpen:!0}):this.dom.dropdown.classList.add("open")}closeDropdown(){this.dom.dropdown.classList.remove("open")}}function initGeoPopup({forceOpen=!1}){fetch("https://get.geojs.io/v1/ip/geo.json",{mode:"cors"}).then(r=>r.json()).then(geoData=>{const popupElement=document.getElementById("geo-popup");window.storesData&&popupElement&&(window.geoPopup=new GeoPopup(popupElement,window.storesData,geoData,forceOpen))})}const geoDropdownElements=document.querySelectorAll('[data-template="dropdown"]');geoDropdownElements&&window.storesData&&geoDropdownElements.forEac
1h(geoDropdownElement=>{new GeoDropdown(geoDropdownElement,window.storesData)}),getCookie({name:"geoDismissed"})||initGeoPopup({});
2//# sourceMappingURL=/cdn/shop/t/13/assets/geo.js.map?v=55802882670838843241738735535

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.