|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
if (typeof feather !== 'undefined') { |
|
|
feather.replace(); |
|
|
} |
|
|
|
|
|
|
|
|
const serverStatus = { |
|
|
checkStatus: async function() { |
|
|
try { |
|
|
|
|
|
const response = await fetch('/api/server-status'); |
|
|
const data = await response.json(); |
|
|
this.updateStatus(data); |
|
|
} catch (error) { |
|
|
console.log('Server status check failed, using demo data'); |
|
|
|
|
|
this.updateStatus({ |
|
|
online: true, |
|
|
players: 24, |
|
|
maxPlayers: 32, |
|
|
version: '1.20.1' |
|
|
}); |
|
|
} |
|
|
}, |
|
|
|
|
|
updateStatus: function(data) { |
|
|
const statusElement = document.querySelector('.text-green-400'); |
|
|
const playersElement = document.querySelector('.text-2xl.font-bold.text-primary-500'); |
|
|
const versionElement = document.querySelector('.text-lg'); |
|
|
|
|
|
if (statusElement) { |
|
|
statusElement.textContent = data.online ? 'Онлайн' : 'Офлайн'; |
|
|
} |
|
|
if (playersElement) { |
|
|
playersElement.textContent = `${data.players}/${data.maxPlayers}`; |
|
|
} |
|
|
if (versionElement) { |
|
|
versionElement.textContent = data.version; |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
const copyButton = document.querySelector('button'); |
|
|
if (copyButton && copyButton.textContent.includes('Скопировать')) { |
|
|
copyButton.addEventListener('click', function() { |
|
|
const serverIP = 'exemine.mc-server.ru'; |
|
|
navigator.clipboard.writeText(serverIP).then(() => { |
|
|
const originalText = this.textContent; |
|
|
this.textContent = 'Скопировано!'; |
|
|
this.classList.add('bg-green-600'); |
|
|
this.classList.remove('bg-primary-600', 'hover:bg-primary-700'); |
|
|
|
|
|
setTimeout(() => { |
|
|
this.textContent = originalText; |
|
|
this.classList.remove('bg-green-600'); |
|
|
this.classList.add('bg-primary-600', 'hover:bg-primary-700'); |
|
|
}, 2000); |
|
|
}).catch(() => { |
|
|
|
|
|
const textArea = document.createElement('textarea'); |
|
|
textArea.value = serverIP; |
|
|
document.body.appendChild(textArea); |
|
|
textArea.select(); |
|
|
document.execCommand('copy'); |
|
|
document.body.removeChild(textArea); |
|
|
|
|
|
const originalText = this.textContent; |
|
|
this.textContent = 'Скопировано!'; |
|
|
this.classList.add('bg-green-600'); |
|
|
this.classList.remove('bg-primary-600', 'hover:bg-primary-700'); |
|
|
|
|
|
setTimeout(() => { |
|
|
this.textContent = originalText; |
|
|
this.classList.remove('bg-green-600'); |
|
|
this.classList.add('bg-primary-600', 'hover:bg-primary-700'); |
|
|
}, 2000); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
|
|
anchor.addEventListener('click', function (e) { |
|
|
e.preventDefault(); |
|
|
const target = document.querySelector(this.getAttribute('href')); |
|
|
if (target) { |
|
|
target.scrollIntoView({ |
|
|
behavior: 'smooth', |
|
|
block: 'start' |
|
|
}); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
window.addEventListener('scroll', function() { |
|
|
const navbar = document.querySelector('nav'); |
|
|
if (window.scrollY > 100) { |
|
|
navbar.classList.add('bg-gray-800', 'bg-opacity-95'); |
|
|
navbar.classList.remove('bg-gray-800'); |
|
|
} else { |
|
|
navbar.classList.remove('bg-opacity-95'); |
|
|
navbar.classList.add('bg-gray-800'); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const observerOptions = { |
|
|
threshold: 0.1, |
|
|
rootMargin: '0px 0px -50px 0px' |
|
|
}; |
|
|
|
|
|
const observer = new IntersectionObserver(function(entries) { |
|
|
entries.forEach(entry => { |
|
|
if (entry.isIntersecting) { |
|
|
entry.target.classList.add('animate-fade-in'); |
|
|
} |
|
|
}); |
|
|
}, observerOptions); |
|
|
|
|
|
|
|
|
document.querySelectorAll('.bg-gray-800, .bg-gray-900').forEach(el => { |
|
|
el.classList.add('opacity-0', 'transform', 'translate-y-4', 'transition', 'duration-700'); |
|
|
observer.observe(el); |
|
|
}); |
|
|
|
|
|
|
|
|
const style = document.createElement('style'); |
|
|
style.textContent = ` |
|
|
.animate-fade-in { |
|
|
opacity: 1 !important; |
|
|
transform: translateY(0) !important; |
|
|
} |
|
|
`; |
|
|
document.head.appendChild(style); |
|
|
|
|
|
|
|
|
function animateCounter(element, target) { |
|
|
let current = 0; |
|
|
const increment = target / 50; |
|
|
const timer = setInterval(() => { |
|
|
current += increment; |
|
|
if (current >= target) { |
|
|
current = target; |
|
|
clearInterval(timer); |
|
|
} |
|
|
element.textContent = Math.floor(current) + '/32'; |
|
|
}, 30); |
|
|
} |
|
|
|
|
|
|
|
|
document.querySelectorAll('button').forEach(button => { |
|
|
button.addEventListener('click', function(e) { |
|
|
|
|
|
const ripple = document.createElement('span'); |
|
|
ripple.classList.add('absolute', 'bg-white', 'opacity-25', 'rounded-full', 'animate-ping'); |
|
|
const rect = this.getBoundingClientRect(); |
|
|
const size = Math.max(rect.width, rect.height); |
|
|
ripple.style.width = size + 'px'; |
|
|
ripple.style.height = size + 'px'; |
|
|
ripple.style.left = (e.clientX - rect.left - size / 2) + 'px'; |
|
|
ripple.style.top = (e.clientY - rect.top - size / 2) + 'px'; |
|
|
|
|
|
this.style.position = 'relative'; |
|
|
this.style.overflow = 'hidden'; |
|
|
this.appendChild(ripple); |
|
|
|
|
|
setTimeout(() => { |
|
|
ripple.remove(); |
|
|
}, 600); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
serverStatus.checkStatus(); |
|
|
|
|
|
|
|
|
const heroTitle = document.querySelector('h1'); |
|
|
if (heroTitle && heroTitle.textContent.includes('Exemine')) { |
|
|
const originalText = heroTitle.textContent; |
|
|
heroTitle.textContent = ''; |
|
|
|
|
|
let i = 0; |
|
|
const typeWriter = () => { |
|
|
if (i < originalText.length) { |
|
|
heroTitle.textContent += originalText.charAt(i); |
|
|
i++; |
|
|
setTimeout(typeWriter, 100); |
|
|
} |
|
|
}; |
|
|
|
|
|
setTimeout(typeWriter, 500); |
|
|
} |
|
|
|
|
|
|
|
|
document.querySelectorAll('.bg-gray-800').forEach(card => { |
|
|
if (card.querySelector('h3')) { |
|
|
card.classList.add('card-hover', 'cursor-pointer'); |
|
|
|
|
|
card.addEventListener('mouseenter', function() { |
|
|
this.style.transform = 'translateY(-5px)'; |
|
|
this.style.boxShadow = '0 20px 40px rgba(0, 0, 0, 0.3)'; |
|
|
}); |
|
|
|
|
|
card.addEventListener('mouseleave', function() { |
|
|
this.style.transform = 'translateY(0)'; |
|
|
this.style.boxShadow = 'none'; |
|
|
}); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const mobileMenuButton = document.querySelector('.md\\:hidden button'); |
|
|
const mobileMenu = document.querySelector('.md\\:block'); |
|
|
|
|
|
if (mobileMenuButton && mobileMenu) { |
|
|
mobileMenuButton.addEventListener('click', function() { |
|
|
mobileMenu.classList.toggle('hidden'); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
console.log('Exemine website loaded successfully'); |
|
|
console.log('Features loaded:', document.querySelectorAll('.bg-gray-800').length); |
|
|
}); |
|
|
|
|
|
|
|
|
if ('serviceWorker' in navigator) { |
|
|
window.addEventListener('load', function() { |
|
|
navigator.serviceWorker.register('/sw.js') |
|
|
.then(function(registration) { |
|
|
console.log('ServiceWorker registration successful'); |
|
|
}, function(err) { |
|
|
console.log('ServiceWorker registration failed'); |
|
|
}); |
|
|
}); |
|
|
} |