let payingCustomer = false; document.addEventListener("DOMContentLoaded", function () { if (document.location.search.indexOf('nils') == -1) return; const MESSAGE_VIEW_LIMIT = 100; const HIDE_DURATION_DAYS = 3; const MAX_DISMISSALS_FOR_PAYING = 3; function getStorageData(key) { return JSON.parse(localStorage.getItem(key)) || {}; } function setStorageData(key, data) { localStorage.setItem(key, JSON.stringify(data)); } const storageKey = "headerBarState"; const state = getStorageData(storageKey); const now = Date.now(); const lastDismissed = state.lastDismissed || 0; const viewCount = state.viewCount || 0; const dismissCount = state.dismissCount || 0; // Bedingung für zahlende Kunden: Nachricht dauerhaft ausblenden, wenn 3x dismissed if (payingCustomer && dismissCount >= MAX_DISMISSALS_FOR_PAYING) { console.log("Message permanently dismissed for paying customer."); return; } // Nachricht anzeigen, wenn die Bedingungen erfüllt sind if (viewCount >= MESSAGE_VIEW_LIMIT || now - lastDismissed < HIDE_DURATION_DAYS * 24 * 60 * 60 * 1000) return; state.viewCount = (viewCount || 0) + 1; setStorageData(storageKey, state); document.body.style.margin = "0"; document.body.style.padding = "0"; document.body.style.overflowX = "hidden"; document.documentElement.style.boxSizing = "border-box"; document.body.style.boxSizing = "border-box"; const headerBar = document.createElement("div"); headerBar.style.position = "sticky"; headerBar.style.top = "0"; headerBar.style.width = "100%"; headerBar.style.backgroundColor = "#fff"; headerBar.style.color = "#000"; headerBar.style.padding = "10px 20px"; headerBar.style.fontFamily = "Arial, sans-serif"; headerBar.style.zIndex = "1000"; headerBar.style.boxShadow = "0 4px 10px rgba(0, 0, 0, 0.5)"; headerBar.style.boxSizing = "border-box"; headerBar.style.textAlign = "center"; headerBar.style.transition = "opacity 0.5s ease"; headerBar.innerHTML = `
🎉 LaserForum.com is Live! Free Engraving Files, Guides, Individual Help & More! 🎉
Join for Free Today »
Dismiss
`; document.body.insertBefore(headerBar, document.body.firstChild); document.getElementById("dismissMessage").addEventListener("click", function () { headerBar.style.display = "none"; state.lastDismissed = Date.now(); state.dismissCount = (dismissCount || 0) + 1; setStorageData(storageKey, state); if (payingCustomer && state.dismissCount >= MAX_DISMISSALS_FOR_PAYING) { console.log("Message permanently dismissed for paying customer."); } }); let lastScrollTop = 0; window.addEventListener("scroll", function () { const scrollTop = window.scrollY || document.documentElement.scrollTop; if (scrollTop > 0) { headerBar.style.opacity = "0"; } else { headerBar.style.opacity = "1"; } }); });