// Preloader document.addEventListener("DOMContentLoaded", function () { const preloader = document.getElementById('preloader'); const percentText = document.getElementById('loader-percent'); let progress = 0; const interval = setInterval(() => { progress += Math.floor(Math.random() * 5) + 1; if (progress > 100) { progress = 100; clearInterval(interval); setTimeout(() => { preloader.classList.add('done'); document.body.style.overflow = 'auto'; }, 500); } percentText.innerText = progress + '%'; }, 30); }); // Discord Widget document.addEventListener("DOMContentLoaded", function () { const widget = document.getElementById('discord-widget'); const closeBtn = document.getElementById('discord-close-btn'); const isWidgetClosed = document.cookie.split('; ').find(row => row.startsWith('discordWidgetClosed=true')); setTimeout(() => { if (!isWidgetClosed) { widget.classList.add('is-visible'); } }, 3000); closeBtn.addEventListener('click', function () { widget.classList.remove('is-visible'); setTimeout(() => { document.cookie = "discordWidgetClosed=true; max-age=86400; path=/"; }, 400); }); }); const navEl = document.querySelector('.navbar'); window.addEventListener('scroll', () => { if (window.scrollY > 50) { navEl.classList.add('scrolled'); } else { navEl.classList.remove('scrolled'); } }); const scrollBtn = document.getElementById('scrollTopBtn'); window.addEventListener('scroll', () => { if (window.scrollY > 350) { scrollBtn.classList.add('show'); } else { scrollBtn.classList.remove('show'); } }); scrollBtn.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); // FAQ const faqItems = document.querySelectorAll('.faq-item'); faqItems.forEach(item => { const question = item.querySelector('.faq-question'); question.addEventListener('click', () => { faqItems.forEach(i => { if (i !== item) i.classList.remove('active'); }); item.classList.toggle('active'); }); }); // Download popup function startDownload(btn) { const popup = document.getElementById('dlPopup'); const loader = popup.querySelector('.loader-fill'); const nameDisplay = document.getElementById('fileNameDisplay'); const fileName = btn.getAttribute('data-file') || 'unknown_file.zip'; nameDisplay.textContent = fileName; popup.classList.remove('active'); loader.style.transition = 'none'; loader.style.width = '6%'; void popup.offsetWidth; loader.style.transition = 'width 3s ease-out'; popup.classList.add('active'); setTimeout(() => { popup.classList.remove('active'); }, 9000); }