supprime le top des joueur et il faut d'aobord jouer pour le top s'affiche - Initial Deployment
Browse filesFiles changed (2)
- README.md+7-5
- index.html+472-19
123452345678910111012---title: Azertypeemoji: 🚀colorFrom: greencolorTo: yellowtitle: azertypeemoji: 🐳colorFrom: bluecolorTo: pinksdk: staticpinned: falsetags: - deepsite---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-referenceCheck out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference12345678910111213141516171819123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472<!doctype html><html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>My static Space</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="card"> <h1>Welcome to your static Space!</h1> <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p> <p> Also don't forget to check the <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>. </p> </div> </body></html><!DOCTYPE html><html lang="fr"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>AzerType - Jeu de Dactylographie</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <script> tailwind.config = { theme: { extend: { colors: { primary: '#3b82f6', secondary: '#1e40af', accent: '#f59e0b', dark: '#1e293b', light: '#f8fafc' } } } } </script> <style> @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap'); body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #1e3c72, #2a5298); min-height: 100vh; } .typing-word { font-size: 2.5rem; font-weight: 700; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: all 0.3s ease; } .typing-input { font-size: 1.5rem; letter-spacing: 1px; } .timer { font-size: 3rem; font-weight: 700; } .leaderboard-item:nth-child(1) { background: linear-gradient(to right, #fde047, #f59e0b); } .leaderboard-item:nth-child(2) { background: linear-gradient(to right, #d1d5db, #9ca3af); } .leaderboard-item:nth-child(3) { background: linear-gradient(to right, #fca5a5, #ef4444); } .pulse { animation: pulse 1.5s infinite; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } } .correct { color: #10b981; } .incorrect { color: #ef4444; } .progress-bar { transition: width 0.5s ease; } </style></head><body class="text-gray-800"> <div class="container mx-auto px-4 py-8"> <header class="text-center mb-10"> <h1 class="text-4xl md:text-5xl font-bold text-white mb-2">AzerType</h1> <p class="text-xl text-blue-200">Testez votre vitesse de frappe !</p> </header>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 max-w-4xl mx-auto"> <!-- Game Panel --> <div class="bg-white rounded-2xl shadow-xl p-6"> <!-- Player Setup --> <div id="playerSetup" class="mb-8"> <h2 class="text-2xl font-bold text-center mb-6 text-gray-700">Entrez votre pseudo</h2> <div class="max-w-md mx-auto"> <div class="flex"> <input type="text" id="playerName" placeholder="Votre pseudo" class="flex-grow px-4 py-3 rounded-l-lg border-2 border-r-0 border-blue-300 focus:outline-none focus:border-blue-500"> <button id="startGameBtn" class="bg-primary hover:bg-secondary text-white px-6 py-3 rounded-r-lg font-medium transition duration-300"> Commencer </button> </div> </div> </div>
<!-- Game Interface --> <div id="gameInterface" class="hidden"> <div class="flex justify-between items-center mb-8"> <div class="text-center"> <div class="text-sm text-gray-500">Temps restant</div> <div id="timer" class="timer text-red-500">30</div> </div> <div class="text-center"> <div class="text-sm text-gray-500">Score</div> <div id="score" class="text-3xl font-bold text-primary">0</div> </div> <div class="text-center"> <div class="text-sm text-gray-500">Mots</div> <div id="wordCount" class="text-3xl font-bold text-green-500">0</div> </div> </div>
<div class="text-center mb-10"> <div id="currentWord" class="typing-word text-gray-800 mb-8">Chargement...</div> <input type="text" id="typingInput" class="typing-input w-full max-w-md mx-auto px-6 py-4 border-2 border-blue-300 rounded-lg focus:outline-none focus:border-blue-500 text-center" placeholder="Tapez le mot ici..." autocomplete="off" disabled> </div>
<div class="mb-8"> <div class="flex justify-between text-sm text-gray-600 mb-1"> <span>Progression</span> <span id="progressText">0%</span> </div> <div class="h-3 bg-gray-200 rounded-full overflow-hidden"> <div id="progressBar" class="h-full bg-primary rounded-full w-0"></div> </div> </div>
<div class="text-center hidden" id="gameOver"> <div class="bg-blue-50 rounded-xl p-6 mb-6"> <h3 class="text-2xl font-bold text-gray-800 mb-2">Partie terminée !</h3> <p class="text-lg mb-4">Votre score final : <span id="finalScore" class="font-bold text-primary">0</span></p> <button id="restartBtn" class="bg-accent hover:bg-yellow-500 text-white px-6 py-3 rounded-lg font-medium transition duration-300"> <i class="fas fa-redo mr-2"></i>Rejouer </button> </div> </div> </div> </div>
<!-- Leaderboard --> <div class="bg-white rounded-2xl shadow-xl p-6"> <h2 class="text-2xl font-bold text-center mb-6 text-gray-700">Top 10 Joueurs</h2> <div id="leaderboard" class="space-y-3"> <!-- Leaderboard items will be inserted here --> <div class="text-center py-8 text-gray-500"> <i class="fas fa-trophy text-3xl mb-2"></i> <p>Chargement du classement...</p> </div> </div> </div> </div>
<!-- Game Instructions --> <div class="mt-10 bg-white rounded-2xl shadow-xl p-6 max-w-4xl mx-auto"> <h3 class="text-xl font-bold mb-4 text-gray-700">Comment jouer ?</h3> <ul class="grid grid-cols-1 md:grid-cols-3 gap-4"> <li class="flex items-start"> <div class="bg-blue-100 rounded-full p-2 mr-3"> <i class="fas fa-user text-blue-500"></i> </div> <div> <h4 class="font-semibold">1. Entrez votre pseudo</h4> <p class="text-sm text-gray-600">Saisissez votre nom pour commencer</p> </div> </li> <li class="flex items-start"> <div class="bg-green-100 rounded-full p-2 mr-3"> <i class="fas fa-keyboard text-green-500"></i> </div> <div> <h4 class="font-semibold">2. Tapez les mots</h4> <p class="text-sm text-gray-600">Tapez le mot affiché le plus rapidement possible</p> </div> </li> <li class="flex items-start"> <div class="bg-purple-100 rounded-full p-2 mr-3"> <i class="fas fa-trophy text-purple-500"></i> </div> <div> <h4 class="font-semibold">3. Battez des records</h4> <p class="text-sm text-gray-600">Améliorez votre score et montez dans le classement</p> </div> </li> </ul> </div> </div>
<script> // Game state let gameState = { playerName: '', score: 0, wordCount: 0, timeLeft: 30, timer: null, gameActive: false, currentWord: '' };
// DOM Elements const elements = { playerSetup: document.getElementById('playerSetup'), gameInterface: document.getElementById('gameInterface'), playerNameInput: document.getElementById('playerName'), startGameBtn: document.getElementById('startGameBtn'), timerDisplay: document.getElementById('timer'), scoreDisplay: document.getElementById('score'), wordCountDisplay: document.getElementById('wordCount'), currentWordDisplay: document.getElementById('currentWord'), typingInput: document.getElementById('typingInput'), gameOver: document.getElementById('gameOver'), finalScore: document.getElementById('finalScore'), restartBtn: document.getElementById('restartBtn'), leaderboard: document.getElementById('leaderboard'), progressBar: document.getElementById('progressBar'), progressText: document.getElementById('progressText') };
// Initialize game function initGame() { // Event listeners elements.startGameBtn.addEventListener('click', startGame); elements.restartBtn.addEventListener('click', restartGame); elements.typingInput.addEventListener('input', checkInput); // Load leaderboard loadLeaderboard(); }
// Start the game function startGame() { const playerName = elements.playerNameInput.value.trim(); if (!playerName) { alert('Veuillez entrer un pseudo'); return; } gameState.playerName = playerName; elements.playerSetup.classList.add('hidden'); elements.gameInterface.classList.remove('hidden'); resetGame(); startTimer(); fetchNewWord(); elements.typingInput.disabled = false; elements.typingInput.focus(); gameState.gameActive = true; }
// Reset game state function resetGame() { gameState.score = 0; gameState.wordCount = 0; gameState.timeLeft = 30; updateDisplays(); elements.typingInput.value = ''; elements.gameOver.classList.add('hidden'); elements.progressBar.style.width = '0%'; elements.progressText.textContent = '0%'; }
// Start the timer function startTimer() { clearInterval(gameState.timer); gameState.timer = setInterval(() => { gameState.timeLeft--; updateTimerDisplay(); if (gameState.timeLeft <= 0) { endGame(); } }, 1000); }
// Update all displays function updateDisplays() { elements.scoreDisplay.textContent = gameState.score; elements.wordCountDisplay.textContent = gameState.wordCount; updateTimerDisplay(); }
// Update timer display function updateTimerDisplay() { elements.timerDisplay.textContent = gameState.timeLeft; // Change color when time is running low if (gameState.timeLeft <= 10) { elements.timerDisplay.classList.add('text-red-500', 'pulse'); } else { elements.timerDisplay.classList.remove('text-red-500', 'pulse'); } }
// Fetch a new word from the API function fetchNewWord() { // In a real implementation, this would call the API // For demo purposes, we'll use a local word list const words = [ 'clavier', 'ordinateur', 'taper', 'jeu', 'code', 'rapide', 'azerty', 'vitesse', 'react', 'dactylo', 'internet', 'souris', 'ecran', 'programmation', 'developpement', 'javascript', 'php', 'mysql', 'bootstrap', 'tailwind' ]; const randomIndex = Math.floor(Math.random() * words.length); gameState.currentWord = words[randomIndex]; elements.currentWordDisplay.textContent = gameState.currentWord; elements.currentWordDisplay.classList.remove('correct', 'incorrect'); }
// Check user input function checkInput() { if (!gameState.gameActive) return; const typedValue = elements.typingInput.value; // Visual feedback if (typedValue === gameState.currentWord) { elements.currentWordDisplay.classList.add('correct'); elements.currentWordDisplay.classList.remove('incorrect'); } else if (gameState.currentWord.startsWith(typedValue)) { elements.currentWordDisplay.classList.remove('correct', 'incorrect'); } else { elements.currentWordDisplay.classList.add('incorrect'); elements.currentWordDisplay.classList.remove('correct'); } // Check if word is completed if (typedValue === gameState.currentWord) { // Update score and word count gameState.score += gameState.currentWord.length; gameState.wordCount++; // Update progress const progress = Math.min(100, (30 - gameState.timeLeft) * 3.33); elements.progressBar.style.width = `${progress}%`; elements.progressText.textContent = `${Math.round(progress)}%`; // Update displays updateDisplays(); // Clear input and fetch new word elements.typingInput.value = ''; fetchNewWord(); // Add animation effect elements.currentWordDisplay.classList.add('pulse'); setTimeout(() => { elements.currentWordDisplay.classList.remove('pulse'); }, 300); } }
// End the game function endGame() { clearInterval(gameState.timer); gameState.gameActive = false; elements.typingInput.disabled = true; elements.finalScore.textContent = gameState.score; elements.gameOver.classList.remove('hidden'); // Save score (in a real app, this would call the API) saveScore(); }
// Save score to leaderboard function saveScore() { // In a real implementation, this would send to the API // For demo, we'll just update the local leaderboard loadLeaderboard(); }
// Load leaderboard function loadLeaderboard() { // In a real implementation, this would fetch from the API // For demo, we'll use sample data const sampleScores = [ { player: 'Alice', score: 245, played_at: '2023-06-15' }, { player: 'Bob', score: 198, played_at: '2023-06-14' }, { player: 'Charlie', score: 176, played_at: '2023-06-13' }, { player: 'Diana', score: 165, played_at: '2023-06-12' }, { player: 'Eve', score: 142, played_at: '2023-06-11' }, { player: 'Frank', score: 130, played_at: '2023-06-10' }, { player: 'Grace', score: 115, played_at: '2023-06-09' }, { player: 'Henry', score: 98, played_at: '2023-06-08' }, { player: 'Ivy', score: 87, played_at: '2023-06-07' }, { player: 'Jack', score: 75, played_at: '2023-06-06' } ]; renderLeaderboard(sampleScores); // Afficher le leaderboard après la partie document.getElementById('leaderboardSection').classList.remove('hidden'); }
// Render leaderboard function renderLeaderboard(scores) { elements.leaderboard.innerHTML = ''; if (scores.length === 0) { elements.leaderboard.innerHTML = ` <div class="text-center py-8 text-gray-500"> <i class="fas fa-trophy text-3xl mb-2"></i> <p>Aucun score enregistré</p> </div> `; return; } scores.forEach((score, index) => { const position = index + 1; const medalClass = position <= 3 ? (position === 1 ? 'text-yellow-600' : position === 2 ? 'text-gray-600' : 'text-red-600') : 'text-gray-500'; const medalIcon = position <= 3 ? (position === 1 ? 'fa-trophy' : position === 2 ? 'fa-medal' : 'fa-award') : ''; elements.leaderboard.innerHTML += ` <div class="leaderboard-item flex items-center justify-between p-4 rounded-lg ${position <= 3 ? 'text-white' : 'bg-gray-50'}"> <div class="flex items-center"> <div class="w-8 h-8 flex items-center justify-center rounded-full ${position <= 3 ? '' : 'bg-gray-200'}"> <span class="font-bold ${position <= 3 ? 'text-white' : medalClass}"> ${position} </span> </div> <div class="ml-4"> <div class="font-semibold">${score.player}</div> <div class="text-sm ${position <= 3 ? 'text-white/90' : 'text-gray-500'}">${score.played_at}</div> </div> </div> <div class="flex items-center"> <span class="font-bold text-lg mr-2">${score.score}</span> ${position <= 3 ? `<i class="fas ${medalIcon} ${medalClass}"></i>` : ''} </div> </div> `; }); }
// Restart the game function restartGame() { elements.playerSetup.classList.remove('hidden'); elements.gameInterface.classList.add('hidden'); elements.playerNameInput.value = gameState.playerName; }
// Initialize when page loads document.addEventListener('DOMContentLoaded', initGame); </script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=RebCode/azertype" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>README.md+7-5
index.html+472-19