Download index.html from ghost613/math-quiz: direct link, hf CLI and curl.
- Browser
- Download file 16 kB
-
https://huggingface.co/spaces/ghost613/math-quiz/resolve/main/index.html
- Command line
-
hf download hf://spaces/ghost613/math-quiz/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ghost613/math-quiz/resolve/main/index.html
16 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Neon Math Explosion Quiz</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"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap'); | |
| body { | |
| font-family: 'Press Start 2P', cursive; | |
| background-color: #0a0a1a; | |
| color: #fff; | |
| overflow: hidden; | |
| } | |
| .neon-text { | |
| text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff00de, 0 0 30px #ff00de; | |
| color: white; | |
| } | |
| .neon-box { | |
| box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00f7ff, 0 0 30px #00f7ff; | |
| border: 2px solid #00f7ff; | |
| background-color: rgba(0, 0, 20, 0.7); | |
| } | |
| .neon-button { | |
| transition: all 0.3s; | |
| box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00ff88, 0 0 30px #00ff88; | |
| border: 2px solid #00ff88; | |
| background-color: rgba(0, 20, 10, 0.7); | |
| } | |
| .neon-button:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #00ff88, 0 0 40px #00ff88; | |
| } | |
| .option { | |
| transition: all 0.3s; | |
| box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ffcc00, 0 0 30px #ffcc00; | |
| border: 2px solid #ffcc00; | |
| background-color: rgba(20, 15, 0, 0.7); | |
| } | |
| .option:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #ffcc00, 0 0 40px #ffcc00; | |
| } | |
| .correct { | |
| animation: correct 1s; | |
| box-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88; | |
| } | |
| .wrong { | |
| animation: wrong 1s; | |
| box-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000; | |
| } | |
| @keyframes correct { | |
| 0% { transform: scale(1); } | |
| 50% { transform: scale(1.1); } | |
| 100% { transform: scale(1); } | |
| } | |
| @keyframes wrong { | |
| 0% { transform: scale(1); } | |
| 50% { transform: scale(0.9); } | |
| 100% { transform: scale(1); } | |
| } | |
| .explosion { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-color: #ff0000; | |
| opacity: 0; | |
| z-index: 100; | |
| pointer-events: none; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| font-size: 5rem; | |
| color: white; | |
| text-shadow: 0 0 10px black; | |
| animation: explosion 2s ease-out; | |
| } | |
| @keyframes explosion { | |
| 0% { opacity: 0; transform: scale(0.1); } | |
| 20% { opacity: 1; } | |
| 100% { opacity: 0; transform: scale(2); } | |
| } | |
| .particle { | |
| position: absolute; | |
| background-color: #ff9900; | |
| border-radius: 50%; | |
| pointer-events: none; | |
| } | |
| .score-display { | |
| font-size: 2rem; | |
| text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00ff88, 0 0 30px #00ff88; | |
| } | |
| .question { | |
| min-height: 100px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen flex flex-col items-center justify-center p-4"> | |
| <div id="app" class="w-full max-w-2xl"> | |
| <h1 class="text-4xl md:text-5xl text-center mb-8 neon-text">NEON MATH EXPLOSION</h1> | |
| <div class="neon-box rounded-lg p-6 mb-8"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <div class="score-display">Score: <span id="score">0</span></div> | |
| <div class="text-xl">Question: <span id="question-number">1</span>/10</div> | |
| </div> | |
| <div class="question text-2xl mb-8 text-center" id="question"> | |
| Loading question... | |
| </div> | |
| <div class="grid grid-cols-2 gap-4 mb-6" id="options"> | |
| <!-- Options will be inserted here --> | |
| </div> | |
| <div class="flex justify-center"> | |
| <button id="next-btn" class="neon-button py-3 px-6 rounded-lg text-lg hidden"> | |
| NEXT QUESTION <i class="fas fa-arrow-right ml-2"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div id="start-screen" class="neon-box rounded-lg p-8 text-center"> | |
| <h2 class="text-2xl md:text-3xl mb-6 neon-text">READY FOR THE CHALLENGE?</h2> | |
| <p class="mb-8">Answer 10 math questions correctly... or face explosive consequences!</p> | |
| <button id="start-btn" class="neon-button py-3 px-8 rounded-lg text-xl"> | |
| START QUIZ <i class="fas fa-bolt ml-2"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div id="explosion" class="explosion hidden"> | |
| BOOM! | |
| </div> | |
| <div id="game-over" class="neon-box rounded-lg p-8 text-center hidden absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 w-4/5 max-w-md"> | |
| <h2 class="text-3xl mb-6 neon-text">GAME OVER</h2> | |
| <p class="mb-4 text-xl">Your final score:</p> | |
| <p class="text-4xl mb-8 score-display" id="final-score">0</p> | |
| <button id="restart-btn" class="neon-button py-3 px-8 rounded-lg text-xl"> | |
| PLAY AGAIN <i class="fas fa-redo ml-2"></i> | |
| </button> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // DOM elements | |
| const startScreen = document.getElementById('start-screen'); | |
| const app = document.getElementById('app'); | |
| const questionElement = document.getElementById('question'); | |
| const optionsContainer = document.getElementById('options'); | |
| const nextButton = document.getElementById('next-btn'); | |
| const scoreElement = document.getElementById('score'); | |
| const questionNumberElement = document.getElementById('question-number'); | |
| const startButton = document.getElementById('start-btn'); | |
| const explosionElement = document.getElementById('explosion'); | |
| const gameOverScreen = document.getElementById('game-over'); | |
| const finalScoreElement = document.getElementById('final-score'); | |
| const restartButton = document.getElementById('restart-btn'); | |
| // Quiz variables | |
| let currentQuestionIndex = 0; | |
| let score = 0; | |
| let questions = []; | |
| let selectedAnswer = null; | |
| let quizActive = false; | |
| // Generate questions | |
| function generateQuestions() { | |
| const operations = ['+', '-', '*', '/']; | |
| questions = []; | |
| for (let i = 0; i < 10; i++) { | |
| const operation = operations[Math.floor(Math.random() * operations.length)]; | |
| let num1, num2, answer; | |
| switch(operation) { | |
| case '+': | |
| num1 = Math.floor(Math.random() * 50) + 10; | |
| num2 = Math.floor(Math.random() * 50) + 10; | |
| answer = num1 + num2; | |
| break; | |
| case '-': | |
| num1 = Math.floor(Math.random() * 50) + 30; | |
| num2 = Math.floor(Math.random() * num1) + 1; | |
| answer = num1 - num2; | |
| break; | |
| case '*': | |
| num1 = Math.floor(Math.random() * 12) + 1; | |
| num2 = Math.floor(Math.random() * 12) + 1; | |
| answer = num1 * num2; | |
| break; | |
| case '/': | |
| num2 = Math.floor(Math.random() * 10) + 1; | |
| answer = Math.floor(Math.random() * 10) + 1; | |
| num1 = num2 * answer; | |
| break; | |
| } | |
| // Generate options | |
| let options = [answer]; | |
| while (options.length < 4) { | |
| let wrongAnswer; | |
| if (operation === '/') { | |
| wrongAnswer = Math.floor(Math.random() * 15) + 1; | |
| } else { | |
| wrongAnswer = answer + (Math.floor(Math.random() * 10) - 5); | |
| } | |
| if (wrongAnswer !== answer && !options.includes(wrongAnswer) && wrongAnswer > 0) { | |
| options.push(wrongAnswer); | |
| } | |
| } | |
| // Shuffle options | |
| options = options.sort(() => Math.random() - 0.5); | |
| questions.push({ | |
| question: `${num1} ${operation} ${num2} = ?`, | |
| answer: answer, | |
| options: options | |
| }); | |
| } | |
| } | |
| // Start quiz | |
| function startQuiz() { | |
| generateQuestions(); | |
| currentQuestionIndex = 0; | |
| score = 0; | |
| quizActive = true; | |
| scoreElement.textContent = score; | |
| questionNumberElement.textContent = 1; | |
| startScreen.classList.add('hidden'); | |
| app.classList.remove('hidden'); | |
| showQuestion(); | |
| } | |
| // Show question | |
| function showQuestion() { | |
| const currentQuestion = questions[currentQuestionIndex]; | |
| questionElement.textContent = currentQuestion.question; | |
| optionsContainer.innerHTML = ''; | |
| currentQuestion.options.forEach((option, index) => { | |
| const optionElement = document.createElement('div'); | |
| optionElement.className = 'option py-4 px-2 rounded-lg text-center cursor-pointer text-xl'; | |
| optionElement.textContent = option; | |
| optionElement.dataset.option = option; | |
| optionElement.addEventListener('click', selectAnswer); | |
| optionsContainer.appendChild(optionElement); | |
| }); | |
| nextButton.classList.add('hidden'); | |
| selectedAnswer = null; | |
| } | |
| // Select answer | |
| function selectAnswer(e) { | |
| if (!quizActive || selectedAnswer !== null) return; | |
| const selectedOption = e.target; | |
| const currentQuestion = questions[currentQuestionIndex]; | |
| selectedAnswer = selectedOption.dataset.option; | |
| // Disable all options | |
| const options = document.querySelectorAll('.option'); | |
| options.forEach(option => { | |
| option.style.pointerEvents = 'none'; | |
| if (option.dataset.option == currentQuestion.answer) { | |
| option.classList.add('correct'); | |
| } | |
| }); | |
| // Check if answer is correct | |
| if (selectedAnswer == currentQuestion.answer) { | |
| selectedOption.classList.add('correct'); | |
| score += 10; | |
| scoreElement.textContent = score; | |
| } else { | |
| selectedOption.classList.add('wrong'); | |
| createExplosion(); | |
| } | |
| nextButton.classList.remove('hidden'); | |
| } | |
| // Next question | |
| function nextQuestion() { | |
| currentQuestionIndex++; | |
| questionNumberElement.textContent = currentQuestionIndex + 1; | |
| if (currentQuestionIndex < questions.length) { | |
| showQuestion(); | |
| } else { | |
| endQuiz(); | |
| } | |
| } | |
| // Create explosion effect | |
| function createExplosion() { | |
| explosionElement.classList.remove('hidden'); | |
| // Create particles | |
| for (let i = 0; i < 50; i++) { | |
| const particle = document.createElement('div'); | |
| particle.className = 'particle'; | |
| const size = Math.random() * 20 + 5; | |
| particle.style.width = `${size}px`; | |
| particle.style.height = `${size}px`; | |
| particle.style.left = `${Math.random() * 100}%`; | |
| particle.style.top = `${Math.random() * 100}%`; | |
| document.body.appendChild(particle); | |
| // Animate particles | |
| const angle = Math.random() * Math.PI * 2; | |
| const distance = Math.random() * 300 + 100; | |
| const duration = Math.random() * 2 + 1; | |
| particle.animate([ | |
| { transform: 'translate(0, 0)', opacity: 1 }, | |
| { transform: `translate(${Math.cos(angle) * distance}px, ${Math.sin(angle) * distance}px)`, opacity: 0 } | |
| ], { | |
| duration: duration * 1000, | |
| easing: 'cubic-bezier(0.4, 0, 0.2, 1)' | |
| }); | |
| // Remove particle after animation | |
| setTimeout(() => { | |
| particle.remove(); | |
| }, duration * 1000); | |
| } | |
| // Hide explosion after animation | |
| setTimeout(() => { | |
| explosionElement.classList.add('hidden'); | |
| }, 2000); | |
| } | |
| // End quiz | |
| function endQuiz() { | |
| quizActive = false; | |
| finalScoreElement.textContent = score; | |
| gameOverScreen.classList.remove('hidden'); | |
| } | |
| // Restart quiz | |
| function restartQuiz() { | |
| gameOverScreen.classList.add('hidden'); | |
| startQuiz(); | |
| } | |
| // Event listeners | |
| startButton.addEventListener('click', startQuiz); | |
| nextButton.addEventListener('click', nextQuestion); | |
| restartButton.addEventListener('click', restartQuiz); | |
| }); | |
| </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=ghost613/math-quiz" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body> | |
| </html> |