/* =========================== HIỆU ỨNG QUAY SỐ ============================ */ function animateCounter(target) { let current = 0; const el = document.getElementById("trusted-count"); const speed = Math.max(1, Math.floor(target / 40)); const interval = setInterval(() => { current += speed; if (current >= target) { current = target; clearInterval(interval); } el.textContent = current; }, 20); } /* =========================== TĂNG MỖI KHI VÀO WEB ============================ */ ref.transaction(count => (count || 0) + 1) .then(result => animateCounter(result.snapshot.val())) .catch(() => { ref.once("value").then(snap => { animateCounter(snap.val() || 0); }); }); /* =========================== ACCEPT / REJECT TERMS ============================ */ function acceptTerms() { document.getElementById("popupOverlay").style.display = "none"; const music = document.getElementById("backgroundMusic"); const extraVideo = document.getElementById("extra-video"); extraVideo.style.display = "block"; extraVideo.play(); music.play(); if (!document.fullscreenElement) { document.documentElement.requestFullscreen(); } } function rejectTerms() { window.location.href = "https://www.google.com"; }