mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
changes
This commit is contained in:
+113
-22
@@ -105,35 +105,126 @@ function hideAchievements() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Doom-style cheat code toggle
|
||||||
|
const CHEAT_CODE = 'IDKFA';
|
||||||
|
let cheatCodeIndex = 0;
|
||||||
|
let cheatCodeTimer;
|
||||||
|
|
||||||
// Initialize achievements
|
// Initialize achievements
|
||||||
function initializeAchievements() {
|
function initializeAchievements() {
|
||||||
// Check if achievements were enabled before
|
// Check if achievements were enabled before
|
||||||
achievementsEnabled = JSON.parse(localStorage.getItem('achievementsEnabled') || 'false');
|
achievementsEnabled = JSON.parse(localStorage.getItem('achievementsEnabled') || 'false');
|
||||||
|
|
||||||
// Add hidden toggle button
|
// Initialize particle effects
|
||||||
const hiddenToggle = document.createElement('button');
|
const particleContainer = document.getElementById('particleContainer');
|
||||||
hiddenToggle.className = 'hidden';
|
let particles = [];
|
||||||
hiddenToggle.style.cssText = `
|
|
||||||
position: fixed;
|
|
||||||
bottom: -100px;
|
|
||||||
right: -100px;
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: transform 0.3s;
|
|
||||||
`;
|
|
||||||
|
|
||||||
hiddenToggle.onclick = () => {
|
function createParticle() {
|
||||||
toggleAchievements();
|
const particle = document.createElement('div');
|
||||||
hiddenToggle.style.transform = 'translate(-50px, -50px)';
|
particle.className = 'particle';
|
||||||
setTimeout(() => {
|
|
||||||
hiddenToggle.style.transform = '';
|
// Random position
|
||||||
}, 1000);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
document.body.appendChild(hiddenToggle);
|
// 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
|
||||||
|
if (cheatCodeTimer) {
|
||||||
|
clearTimeout(cheatCodeTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
cheatCodeTimer = setTimeout(() => {
|
||||||
|
cheatCodeIndex = 0;
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
// Check if key matches current position in cheat code
|
||||||
|
if (e.key.toUpperCase() === CHEAT_CODE[cheatCodeIndex]) {
|
||||||
|
cheatCodeIndex++;
|
||||||
|
|
||||||
|
// If complete code entered
|
||||||
|
if (cheatCodeIndex === CHEAT_CODE.length) {
|
||||||
|
// Show achievement unlocked animation
|
||||||
|
const achievementToast = document.createElement('div');
|
||||||
|
achievementToast.className = 'fixed bottom-4 right-4 bg-white rounded-lg shadow-lg p-4 w-64 flex items-center text-green-500';
|
||||||
|
achievementToast.innerHTML = `
|
||||||
|
<div class="flex-1">
|
||||||
|
<h3 class="font-bold text-lg">Achievement Unlocked!</h3>
|
||||||
|
<p class="text-gray-600">"IDKFA" cheat code activated</p>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-trophy text-2xl ml-4"></i>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(achievementToast);
|
||||||
|
|
||||||
|
// Play achievement sound
|
||||||
|
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();
|
||||||
|
|
||||||
|
// Reset cheat code
|
||||||
|
cheatCodeIndex = 0;
|
||||||
|
|
||||||
|
// Remove achievement toast after 3 seconds
|
||||||
|
setTimeout(() => {
|
||||||
|
achievementToast.remove();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Reset cheat code if wrong key pressed
|
||||||
|
cheatCodeIndex = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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
|
// Check achievements when enabled
|
||||||
if (achievementsEnabled) {
|
if (achievementsEnabled) {
|
||||||
|
|||||||
+124
-23
@@ -17,22 +17,31 @@
|
|||||||
|
|
||||||
/* Achievements styles */
|
/* Achievements styles */
|
||||||
#achievementsDisplay {
|
#achievementsDisplay {
|
||||||
position: fixed;
|
width: 100%;
|
||||||
top: 10px;
|
max-width: 1200px;
|
||||||
right: 10px;
|
margin: 0 auto;
|
||||||
background: white;
|
background: rgba(255, 255, 255, 0.95);
|
||||||
padding: 1rem;
|
padding: 2rem;
|
||||||
border-radius: 0.5rem;
|
border-radius: 20px;
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
display: none;
|
display: none;
|
||||||
z-index: 1000;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.achievement-item {
|
.achievement-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0.5rem;
|
padding: 1.5rem;
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-item:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
transform: translateX(10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.achievement-item:last-child {
|
.achievement-item:last-child {
|
||||||
@@ -40,8 +49,85 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.achievement-icon {
|
.achievement-icon {
|
||||||
|
font-size: 2rem;
|
||||||
|
margin-right: 1.5rem;
|
||||||
|
animation: float 3s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-title {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
margin-right: 0.75rem;
|
font-weight: bold;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-description {
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-progress {
|
||||||
|
width: 100%;
|
||||||
|
height: 4px;
|
||||||
|
background: #eee;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-top: 1rem;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.achievement-progress-bar {
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(90deg, #4a6cf7, #6355f7);
|
||||||
|
width: 0;
|
||||||
|
transition: width 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes float {
|
||||||
|
0% {
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Particle effects */
|
||||||
|
.particle-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.particle {
|
||||||
|
position: absolute;
|
||||||
|
width: 4px;
|
||||||
|
height: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: particle 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes particle {
|
||||||
|
0% {
|
||||||
|
transform: translateY(0) translateX(0) scale(1);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(100vh) translateX(100vw) scale(0);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
@@ -617,34 +703,49 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<!-- Particle effects container -->
|
||||||
|
<div class="particle-container" id="particleContainer"></div>
|
||||||
|
|
||||||
<!-- Achievements display -->
|
<!-- Achievements display -->
|
||||||
<div id="achievementsDisplay">
|
<div id="achievementsDisplay">
|
||||||
<div class="achievement-item">
|
<div class="achievement-item">
|
||||||
<i class="fas fa-star achievement-icon text-yellow-500"></i>
|
<i class="fas fa-star achievement-icon text-yellow-500"></i>
|
||||||
<div>
|
<div class="achievement-content">
|
||||||
<h4 class="font-bold">Nováček</h4>
|
<h4 class="achievement-title">Nováček</h4>
|
||||||
<p class="text-sm text-gray-600">První návštěva na portálu</p>
|
<p class="achievement-description">První návštěva na portálu</p>
|
||||||
|
<div class="achievement-progress">
|
||||||
|
<div class="achievement-progress-bar" id="achievement1Progress"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="achievement-item">
|
<div class="achievement-item">
|
||||||
<i class="fas fa-clock-rotate-left achievement-icon text-blue-500"></i>
|
<i class="fas fa-clock-rotate-left achievement-icon text-blue-500"></i>
|
||||||
<div>
|
<div class="achievement-content">
|
||||||
<h4 class="font-bold">Pravidelný návštěvník</h4>
|
<h4 class="achievement-title">Pravidelný návštěvník</h4>
|
||||||
<p class="text-sm text-gray-600">10 návštěv za měsíc</p>
|
<p class="achievement-description">10 návštěv za měsíc</p>
|
||||||
|
<div class="achievement-progress">
|
||||||
|
<div class="achievement-progress-bar" id="achievement2Progress"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="achievement-item">
|
<div class="achievement-item">
|
||||||
<i class="fas fa-rocket achievement-icon text-purple-500"></i>
|
<i class="fas fa-rocket achievement-icon text-purple-500"></i>
|
||||||
<div>
|
<div class="achievement-content">
|
||||||
<h4 class="font-bold">Power User</h4>
|
<h4 class="achievement-title">Power User</h4>
|
||||||
<p class="text-sm text-gray-600">50 návštěv za měsíc</p>
|
<p class="achievement-description">50 návštěv za měsíc</p>
|
||||||
|
<div class="achievement-progress">
|
||||||
|
<div class="achievement-progress-bar" id="achievement3Progress"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="achievement-item">
|
<div class="achievement-item">
|
||||||
<i class="fas fa-award achievement-icon text-gold"></i>
|
<i class="fas fa-award achievement-icon text-gold"></i>
|
||||||
<div>
|
<div class="achievement-content">
|
||||||
<h4 class="font-bold">Super Fan</h4>
|
<h4 class="achievement-title">Super Fan</h4>
|
||||||
<p class="text-sm text-gray-600">100 návštěv za měsíc</p>
|
<p class="achievement-description">100 návštěv za měsíc</p>
|
||||||
|
<div class="achievement-progress">
|
||||||
|
<div class="achievement-progress-bar" id="achievement4Progress"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user