Files
TEAMGATTACAHUB/js/main.js
T
2026-06-25 21:24:44 +00:00

42 lines
1.5 KiB
JavaScript

document.getElementById('year').textContent = new Date().getFullYear();
const gameCount = document.querySelectorAll('.cards .card:not(.card-locked)').length;
function animateCount(el, target){
let n = 0;
const step = Math.max(1, Math.ceil(target / 20));
const t = setInterval(() => {
n += step;
if (n >= target){ n = target; clearInterval(t); }
el.textContent = String(n).padStart(2,'0');
}, 50);
}
animateCount(document.getElementById('stat-games'), gameCount);
const today = new Date();
document.getElementById('stat-date').textContent =
String(today.getMonth()+1).padStart(2,'0') + '.' +
String(today.getDate()).padStart(2,'0') + '.' +
String(today.getFullYear()).slice(-2);
const filterBtns = document.querySelectorAll('.filter-btn');
const cards = document.querySelectorAll('.cards .card');
filterBtns.forEach(btn => {
btn.addEventListener('click', () => {
filterBtns.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const f = btn.dataset.filter;
cards.forEach(c => {
if (f === 'all' || c.dataset.cat === f) c.classList.remove('hidden');
else c.classList.add('hidden');
});
});
});
const heroBg = document.querySelector('.hero-bg');
window.addEventListener('scroll', () => {
const y = window.scrollY;
if (y < window.innerHeight) heroBg.style.transform = `scale(1.05) translateY(${y * 0.15}px)`;
}, { passive: true });
console.log('%c// GAME HUB // online','color:#a8b84a;font-family:monospace;font-size:14px');