var monsterinsights_frontend = {"js_events_tracking":"true","download_extensions":"doc,pdf,ppt,zip,xls,docx,pptx,xlsx","inbound_paths":"[{\"path\":\"\\\/goto\\\/\",\"label\":\"affiliate\"},{\"path\":\"\\\/recommend\\\/\",\"label\":\"affiliate\"}]","home_url":"https:\/\/legaleonlinecasinos.ch","hash_tracking":"false","v4_id":"G-9J2B0QFBJK"};
var breeze_prefetch = {"local_url":"https://legaleonlinecasinos.ch","ignore_remote_prefetch":"1","ignore_list":["wp-admin","wp-login.php"]};
//# sourceURL=breeze-prefetch-js-extra
Schreib uns! Bei jedweder Art von Fragen zu Schweizer Online Casinos kannst du gern unser Kontaktformular verwenden – auch bei schwierigen Themen wie Spielsucht geben wir unser bestes, dir zu helfen. Wir sind übrigens auch immer offen für Kritik und Anregungen und bemühen uns, die Antwortzeiten so kurz wie möglich zu halten. Auf Wiederlesen!
Wir verwenden Cookies, um dir die bestmögliche Nutzung unserer Website zu ermöglichen. Wenn du diese Website weiter nutzt, gehen wir davon aus, dass du damit einverstanden bist.
(function () {
// Configuration
var CONFIG = {
delayMs: 10100,
rememberDays: 0,
variants: {"AT":{"image":"https:\/\/legaleonlinecasinos.ch\/wp-content\/uploads\/2025\/12\/Sultanbet-Gratiswette-ohne-Einzahlung-2026.webp","link":"https:\/\/legaleonlinecasinos.ch\/goto\/sultanbet","alt":"Jetzt f\u00fcr 2026 deine exklusive \u20ac5 No Deposit Freebet bei Sultanbet abholen"},"CH":{"image":"https:\/\/legaleonlinecasinos.ch\/wp-content\/uploads\/2026\/04\/777-Gutscheincode-MAXBONUS-2026-q2.webp","link":"https:\/\/legaleonlinecasinos.ch\/goto\/casino777","alt":"Hole Dir deine 10 Euro ohne Einzahlung exklusiv mit MAXBONUS"},"DEFAULT":{"image":"https:\/\/legaleonlinecasinos.ch\/wp-content\/uploads\/2025\/12\/Sultanbet-Gratiswette-ohne-Einzahlung-2026.webp","link":"https:\/\/legaleonlinecasinos.ch\/goto\/sultanbet","alt":"Jetzt f\u00fcr 2026 deine exklusive \u20ac5 No Deposit Freebet bei Sultanbet abholen"}},
linkTarget: '_blank',
linkRel: 'noopener nofollow',
};
var now = Date.now();
var lsKey = 'simpleImagePopupDismissedAt';
var chosenVariant = null;
var chosenCountry = null;
// Cache DOM elements
var overlay = document.querySelector('.sip-overlay');
var modal = document.querySelector('.sip-modal');
var card = document.querySelector('.sip-card');
var btnClose = document.querySelector('.sip-close');
var link = document.querySelector('.sip-link');
var img = document.getElementById('sip-popup-image');
// Validate DOM
if (!overlay || !modal || !card || !btnClose || !link || !img) {
console.error('[Popup GEO] Required DOM elements not found');
return;
}
// Check cool-off period
function shouldShow() {
try {
var ts = localStorage.getItem(lsKey);
if (CONFIG.rememberDays > 0 && ts) {
var daysPassed = (now - parseInt(ts, 10)) / (24 * 60 * 60 * 1000);
if (daysPassed < CONFIG.rememberDays) {
console.log('[Popup GEO] Cool-off period active (' + Math.floor(daysPassed) + ' days)');
return false;
}
}
} catch (e) {
// localStorage unavailable, show anyway
}
return true;
}
function selectVariant(countryCode) {
var key = countryCode && CONFIG.variants[countryCode] ? countryCode : 'DEFAULT';
chosenCountry = countryCode;
chosenVariant = CONFIG.variants[key] || CONFIG.variants['DEFAULT'];
console.log('[Popup GEO] Country: ' + countryCode + ' → Key: ' + key);
}
function applyVariantToDOM() {
if (!chosenVariant) return;
// Update link
if (chosenVariant.link) {
link.href = chosenVariant.link;
}
// Update image with loading state
if (chosenVariant.image) {
img.classList.add('sip-loading');
// Preload image to smooth transition
var preloadImg = new Image();
preloadImg.onload = function() {
img.src = chosenVariant.image;
img.classList.remove('sip-loading');
console.log('[Popup GEO] Image loaded: ' + chosenVariant.image);
};
preloadImg.onerror = function() {
// Fallback: set src anyway
img.src = chosenVariant.image;
img.classList.remove('sip-loading');
console.warn('[Popup GEO] Image load failed, using fallback');
};
preloadImg.src = chosenVariant.image;
}
// Update alt text
if (chosenVariant.alt) {
img.alt = chosenVariant.alt;
}
console.log('[Popup GEO] Variant applied → Link: ' + link.href);
}
function openPopup() {
applyVariantToDOM();
overlay.setAttribute('aria-hidden', 'false');
modal.setAttribute('aria-hidden', 'false');
document.documentElement.classList.add('sip-open');
document.body.classList.add('sip-open');
card.focus();
}
function closePopup() {
overlay.setAttribute('aria-hidden', 'true');
modal.setAttribute('aria-hidden', 'true');
document.documentElement.classList.remove('sip-open');
document.body.classList.remove('sip-open');
try {
localStorage.setItem(lsKey, String(now));
} catch (e) {
// localStorage unavailable
}
}
// Event listeners
modal.addEventListener('click', function (e) {
if (!card.contains(e.target)) closePopup();
});
btnClose.addEventListener('click', closePopup);
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && modal.getAttribute('aria-hidden') === 'false') {
closePopup();
}
});
// Geo lookup + show popup
function initPopup() {
if (!shouldShow()) return;
try {
fetch('https://ipapi.co/country/', { signal: AbortSignal.timeout(3000) })
.then(function (res) {
return res.ok ? res.text() : null;
})
.then(function (text) {
var cc = text ? text.trim().toUpperCase() : null;
selectVariant(cc);
setTimeout(openPopup, CONFIG.delayMs);
})
.catch(function (err) {
console.log('[Popup GEO] Geo fetch failed, using DEFAULT');
selectVariant(null);
setTimeout(openPopup, CONFIG.delayMs);
});
} catch (e) {
console.error('[Popup GEO] Error:', e);
selectVariant(null);
setTimeout(openPopup, CONFIG.delayMs);
}
}
// Start when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initPopup);
} else {
initPopup();
}
})();