document.addEventListener('DOMContentLoaded', () => {
    const body = document.querySelector('body');
    const slash = document.querySelector('.loader-char');
    const loader = document.querySelector('.loader');
    const cookie = document.cookie.includes("loaderPlayed=true");
    const startLoader = () => {
        loader.style.display = 'flex';
        body.classList.add('overlay__opened');
        const counterElement = document.querySelector(".loader-counter");
        let currentValue = 0;
        const slashAnimation = gsap.timeline({ repeat: -1, repeatDelay: 0.5 });
        slashAnimation
            .to(slash, {
                rotation: 360,
                duration: 2,
                ease: Power1.easeInOut
            })
            .to(
                slash,
                {
                    duration: 0.5,
                    ease: Elastic.easeOut.config(1, 0.3)
                },
                "-=0.2"
            )
            .to(
                slash,
                {
                    duration: 0.5,
                    ease: Elastic.easeOut.config(1, 0.3)
                }
            );
        gsap.to([".loader-counter", ".loader-char", ".loader-text"], 0.25, {
            delay: 3.5,
            height: 0,
            opacity: 0
        })
        gsap.to(".loader-bar", 1.5, {
            delay: 3.5,
            height: 0,
            stagger: {
                amount: 0.5
            },
            ease: "power4.inOut"
        })
        gsap.to(".loader", 0.25, {
            delay: 4.7,
            onComplete: function () {
                document.querySelector(".loader").style.display = "none";
            }
        })
        const updateCounter = () => {
            if (currentValue === 100) {
                setTimeout(() => {
                    body.classList.remove('overlay__opened');
                    setLoaderPlayedCookie();
                }, 1000)
                return;
            }
            currentValue += Math.floor(Math.random() * 10) + 1;
            if (currentValue > 100) {
                currentValue = 100;
            }
            counterElement.textContent = currentValue;
            let delay = Math.floor(Math.random() * 200) + 50;
            setTimeout(updateCounter, delay);
        }
        updateCounter();
    }
    const setLoaderPlayedCookie = () => {
        const expirationDate = new Date();
        expirationDate.setHours(expirationDate.getHours() + 1);
        document.cookie = "loaderPlayed=true; expires=" + expirationDate.toUTCString() + "; path=/";
    }
    if (!cookie) {
        startLoader();
    } else {
        loader.style.display = 'none';
    }
})  .hidden-content {
  display: none;
}<body class="hidden-content">
  <!-- Ваш контент здесь -->
</body>// В вашем JavaScript скрипте, когда лоадер готов
document.addEventListener('DOMContentLoaded', () => {
  // ... Ваш код лоадера ...
  // Удалите класс 'hidden-content' со страницы, чтобы показать контент
  body.classList.remove('hidden-content');
});