{
attempts++;
if (typeof window.geotargetly_country_code === "function") {
const countryCode = geotargetly_country_code();
this.targetSiteLocale = countryCode;
// If user is on the correct site, dont show ip-filter
that.geoTargetlyLoaded = true;
that.updateCountry(countryCode);
if(countryCode == that.currentSite){
clearInterval(interval);
return;
}
clearInterval(interval);
}else if(attempts >= 15){
clearInterval(interval);
}
}, 100);
const cookie = this.getCookie("ip_filter_hidden");
if(cookie === null){
this.$refs.ipFilter.style.setProperty("display", "flex", "important");
}
},
updateCountry(code){
this.selectedCountry = this.availableCountries.find(item => item.code == code) || this.availableCountries.find(item => item.code == "XX");
},
setCookie(name, value, days) {
let date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
let expires = "expires=" + date.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
this.showView = false;
},
getCookie(name) {
let nameEQ = name + "=";
let ca = document.cookie.split(";");
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
}
return null;
},
navigateTo(url){
window.location.href = url;
},
checkScroll() {
const scrollTop = window.scrollY; // Amount of scrolling done
const scrollHeight = document.documentElement.scrollHeight; // Total height of the document
const clientHeight = document.documentElement.clientHeight; // Viewport height
const scrolledPercentage = (scrollTop / (scrollHeight - clientHeight)) * 100; // % scrolled
if(this.getCookie("ip_filter_hidden") === null && this.selectedCountry.code != this.currentSite){
// Check if scrolled more than or equal to 25%
this.showView = this.showView || scrolledPercentage >= 25;
}
}
}'
>
{{ svg src="images/icons/chevron.svg" class="fill-white w-3.5 h-[0.563rem] ml-2 absolute right-4 pointer-events-none" }}
{{ svg src="images/icons/close.svg" class="fill-white w-5 h-4 md:w-3.5 md:h-3 ml-2" }}