This commit is contained in:
Dvorinka
2025-06-20 09:17:45 +02:00
parent 48f73a5a94
commit ef05a9f28f
2 changed files with 23 additions and 185 deletions
-61
View File
@@ -115,36 +115,6 @@ function initializeAchievements() {
// Check if achievements were enabled before
achievementsEnabled = JSON.parse(localStorage.getItem('achievementsEnabled') || 'false');
// Initialize particle effects
const particleContainer = document.getElementById('particleContainer');
let particles = [];
function createParticle() {
const particle = document.createElement('div');
particle.className = 'particle';
// Random position
particle.style.left = Math.random() * 100 + 'vw';
particle.style.top = Math.random() * 100 + 'vh';
// Random size
const size = Math.random() * 2 + 2;
particle.style.width = size + 'px';
particle.style.height = size + 'px';
// Random color
const colors = ['#4a6cf7', '#6355f7', '#3a56d4', '#2839b0'];
particle.style.background = colors[Math.floor(Math.random() * colors.length)];
particleContainer.appendChild(particle);
particles.push(particle);
}
// Create initial particles
for (let i = 0; i < 50; i++) {
createParticle();
}
// Add cheat code input listener
document.addEventListener('keydown', (e) => {
// Reset timer if no key was pressed in 2 seconds
@@ -178,11 +148,6 @@ function initializeAchievements() {
const audio = new Audio('https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3');
audio.play();
// Create burst of particles
for (let i = 0; i < 20; i++) {
createParticle();
}
// Enable achievements
toggleAchievements();
@@ -200,32 +165,6 @@ function initializeAchievements() {
}
});
// Update progress bars
async function updateProgressBars() {
try {
const response = await fetch('/api/visitor-stats');
const stats = await response.json();
// Calculate progress for each achievement
const achievements = Object.values(ACHIEVEMENTS);
achievements.forEach((achievement, index) => {
if (achievement.period === "monthly") {
const progress = Math.min((stats.monthly_visits / achievement.threshold) * 100, 100);
const progressBar = document.getElementById(`achievement${index + 1}Progress`);
if (progressBar) {
progressBar.style.width = `${progress}%`;
}
}
});
} catch (error) {
console.error('Error updating progress bars:', error);
}
}
// Update progress bars every 5 seconds
setInterval(updateProgressBars, 5000);
// Check achievements when enabled
if (achievementsEnabled) {
checkAchievements();