web: landing page vanilla HTML/CSS/JS avec ambiance sous-marine

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Floppyrj45
2026-04-19 17:57:25 +02:00
parent a12ec18027
commit 9429360966
7 changed files with 926 additions and 0 deletions

32
web/js/main.js Normal file
View File

@@ -0,0 +1,32 @@
// DauphinCraft — main.js (vanilla, no deps)
// Intersection Observer — fade-in sections
const observer = new IntersectionObserver(
(entries) => entries.forEach(e => {
if (e.isIntersecting) { e.target.classList.add('visible'); observer.unobserve(e.target); }
}),
{ threshold: 0.12 }
);
document.querySelectorAll('.fade-in').forEach(el => observer.observe(el));
// Copy server IP to clipboard
function copyServerIP() {
const ip = document.getElementById('server-ip').textContent;
const btn = document.getElementById('btn-copy');
if (!navigator.clipboard) { return; }
navigator.clipboard.writeText(ip).then(() => {
btn.classList.add('copied');
btn.querySelector('svg').style.display = 'none';
const original = btn.innerHTML;
btn.textContent = 'Copié !';
setTimeout(() => { btn.innerHTML = original; btn.classList.remove('copied'); }, 2000);
});
}
// Close mobile menu when a nav link is clicked
document.querySelectorAll('.nav-links a').forEach(a => {
a.addEventListener('click', () => {
const toggle = document.getElementById('nav-toggle');
if (toggle) toggle.checked = false;
});
});