$(() => {
    // $('#auth-visible').hide()

    // Startdatum festlegen (Beispiel: 1. Januar 2025, 00:00:00 Uhr)
    const startDate = new Date('2025-12-13T12:44:00').getTime();

    function updateCounter() {
        const now = new Date().getTime();
        const diff = now - startDate;

        // Berechne Tage, Stunden, Minuten
        const days = Math.floor(diff / (1000 * 60 * 60 * 24));
        const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
        const seconds = Math.floor((diff % (1000 * 60)) / 1000);

        // Zeige den Counter an
        $('#uptime-counter').html(`<strong>${days}</strong> Tage, <strong>${hours}</strong> Stunden, <strong>${minutes}</strong> Minuten und <strong>${seconds}</strong> Sekunden ohne Datenverlust!`);
    }

    // Aktualisiere den Counter sofort und dann jede Minute
    updateCounter();
    setInterval(updateCounter, 1000);

    let agreedToWarning = document.cookie.includes("agreedToWarning=True")
    if(agreedToWarning) {
        $("#contentnotice").hide()
    }
})

function setCookie(cname, cvalue, exdays) {
    const d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    let expires = "expires="+ d.toUTCString();
    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
} 
