Spaces:
Running
Running
Please make a website for learning Japanese that is interactive with lots of animations that make it easy and not boring quickly using HTML, CSS, JS code.
9e01f6f verified Download quiz.html from RefreshBytes/nihongo-ninja-dojo: direct link, hf CLI and curl.
- Browser
- Download file 9.4 kB
-
https://huggingface.co/spaces/RefreshBytes/nihongo-ninja-dojo/resolve/main/quiz.html
- Command line
-
hf download hf://spaces/RefreshBytes/nihongo-ninja-dojo/quiz.html
-
curl -L -o quiz.html https://huggingface.co/spaces/RefreshBytes/nihongo-ninja-dojo/resolve/main/quiz.html
9.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Japanese Quiz - Nihongo Ninja Dojo</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| </head> | |
| <body class="min-h-screen flex flex-col bg-gray-50"> | |
| <custom-navbar></custom-navbar> | |
| <main class="flex-grow pt-20"> | |
| <div class="container mx-auto px-4 py-12"> | |
| <h1 class="text-4xl md:text-5xl font-bold text-center mb-4 text-gray-800"> | |
| Japanese Quiz | |
| </h1> | |
| <p class="text-center text-gray-600 mb-12 max-w-2xl mx-auto"> | |
| Test your knowledge and earn ninja stars! Each correct answer brings you closer to mastery. | |
| </p> | |
| <!-- Quiz Categories --> | |
| <div class="max-w-6xl mx-auto mb-12"> | |
| <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-6"> | |
| <div class="quiz-category interactive-card bg-white rounded-2xl shadow-lg p-6 text-center hover:shadow-2xl transition-all duration-300 transform hover:scale-105"> | |
| <div class="w-20 h-20 mx-auto mb-4 bg-fuchsia-100 rounded-full flex items-center justify-center"> | |
| <i data-feather="a" class="text-fuchsia-500 text-2xl"></i> | |
| </div> | |
| <h3 class="text-lg font-bold text-gray-800">Hiragana</h3> | |
| <p class="text-sm text-gray-600">46 characters</p> | |
| </div> | |
| <div class="quiz-category interactive-card bg-white rounded-2xl shadow-lg p-6 text-center hover:shadow-2xl transition-all duration-300"> | |
| <div class="w-20 h-20 mx-auto mb-4 bg-fuchsia-100 rounded-full flex items-center justify-center"> | |
| <i data-feather="hash" class="text-fuchsia-500 text-2xl"></i> | |
| </div> | |
| <h3 class="text-lg font-bold text-gray-800">Katakana</h3> | |
| <p class="text-sm text-gray-600">46 characters</p> | |
| </div> | |
| <div class="quiz-category interactive-card bg-white rounded-2xl shadow-lg p-6 text-center hover:shadow-2xl transition-all duration-300"> | |
| <div class="w-20 h-20 mx-auto mb-4 bg-fuchsia-100 rounded-full flex items-center justify-center"> | |
| <i data-feather="users" class="text-fuchsia-500 text-2xl"></i> | |
| </div> | |
| <h3 class="text-lg font-bold text-gray-800">Vocabulary</h3> | |
| <p class="text-sm text-gray-600">500+ words</p> | |
| </div> | |
| <div class="quiz-category interactive-card bg-white rounded-2xl shadow-lg p-6 text-center hover:shadow-2xl transition-all duration-300"> | |
| <div class="w-20 h-20 mx-auto mb-4 bg-fuchsia-100 rounded-full flex items-center justify-center"> | |
| <i data-feather="book" class="text-fuchsia-500 text-2xl"></i> | |
| </div> | |
| <h3 class="text-lg font-bold text-gray-800">Grammar</h3> | |
| <p class="text-sm text-gray-600">Essential rules</p> | |
| </div> | |
| </div> | |
| <!-- Active Quiz Section --> | |
| <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-lg p-8"> | |
| <h2 class="text-2xl font-bold mb-6 text-gray-800">Quick Quiz Challenge</h2> | |
| <div id="quiz-container" class="space-y-6"> | |
| <!-- Quiz questions will be dynamically loaded here --> | |
| <div class="text-center py-12"> | |
| <i data-feather="help-circle" class="text-6xl text-gray-300 mb-4"></i> | |
| <p class="text-gray-500">Select a quiz category to begin your challenge!</p> | |
| <button onclick="startRandomQuiz()" class="mt-6 bg-fuchsia-500 hover:bg-fuchsia-600 text-white px-8 py-3 rounded-lg font-bold transition-all duration-300 transform hover:scale-105"> | |
| <i data-feather="shuffle" class="inline mr-2"></i>Random Quiz | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <custom-footer></custom-footer> | |
| <script src="components/navbar.js"></script> | |
| <script src="components/footer.js"></script> | |
| <script src="script.js"></script> | |
| <script> | |
| feather.replace(); | |
| const quizQuestions = [ | |
| { | |
| question: "What does 'γγγ«γ‘γ―' mean?", | |
| options: ["Good morning", "Good afternoon", "Good night", "Thank you"], | |
| correct: 1, | |
| explanation: "γγγ«γ‘γ― (Konnichiwa) means 'Good afternoon' or 'Hello'.", | |
| type: "vocabulary" | |
| }, | |
| { | |
| question: "Which character is the Hiragana for 'a'?", | |
| options: ["γ", "γ", "γ", "γ"], | |
| correct: 0, | |
| explanation: "γ is the Hiragana character for the sound 'a'.", | |
| type: "hiragana" | |
| }, | |
| { | |
| question: "How do you say 'Thank you' in Japanese?", | |
| options: ["γγΏγΎγγ", "γγγγ¨γ", "γγ―γγ", "γγγγͺγ"], | |
| correct: 1, | |
| explanation: "γγγγ¨γ (Arigatou) means 'Thank you'.", | |
| type: "vocabulary" | |
| } | |
| ]; | |
| let currentQuestion = 0; | |
| let score = 0; | |
| function startRandomQuiz() { | |
| currentQuestion = 0; | |
| score = 0; | |
| loadQuestion(); | |
| } | |
| function loadQuestion() { | |
| const container = document.getElementById('quiz-container'); | |
| if (currentQuestion >= quizQuestions.length) { | |
| showResults(); | |
| return; | |
| } | |
| const q = quizQuestions[currentQuestion]; | |
| container.innerHTML = ` | |
| <div class="bg-fuchsia-50 rounded-xl p-6 mb-6"> | |
| <h3 class="text-xl font-bold mb-4 text-gray-800">Question ${currentQuestion + 1}: ${q.question}</h3> | |
| <div class="space-y-3"> | |
| ${q.options.map((option, index) => ` | |
| <button onclick="checkAnswer(${index})" | |
| class="w-full text-left p-4 bg-white border-2 border-gray-200 rounded-lg hover:border-fuchsia-300 transition-all duration-300 quiz-option"> | |
| <span class="option-letter bg-gray-200 text-gray-700 w-8 h-8 rounded-full inline-flex items-center justify-center mr-3"> | |
| ${String.fromCharCode(65 + index)} | |
| </span> | |
| ${option} | |
| </button> | |
| `).join('')} | |
| </div> | |
| </div> | |
| `; | |
| } | |
| function checkAnswer(selectedIndex) { | |
| const q = quizQuestions[currentQuestion]; | |
| const buttons = document.querySelectorAll('.quiz-option'); | |
| buttons.forEach((button, index) => { | |
| if (index === q.correct) { | |
| button.classList.add('bg-green-100', 'border-green-400'); | |
| } else if (index === selectedIndex) { | |
| button.classList.add('bg-red-100', 'border-red-400'); | |
| } | |
| button.disabled = true; | |
| }); | |
| if (selectedIndex === q.correct) { | |
| score++; | |
| createParticles(event.clientX, event.clientY); | |
| } | |
| setTimeout(() => { | |
| currentQuestion++; | |
| loadQuestion(); | |
| }, 2000); | |
| } | |
| function showResults() { | |
| const container = document.getElementById('quiz-container'); | |
| const percentage = Math.round((score / quizQuestions.length) * 100); | |
| container.innerHTML = ` | |
| <div class="text-center py-8"> | |
| <i data-feather="${percentage >= 70 ? 'award' : 'frown'}" | |
| class="text-6xl ${percentage >= 70 ? 'text-yellow-400' : 'text-gray-400'} mb-4"></i> | |
| <h3 class="text-2xl font-bold mb-4 text-gray-800">Quiz Complete!</h3> | |
| <p class="text-4xl font-bold mb-2 ${percentage >= 70 ? 'text-green-500' : 'text-red-500'}"> | |
| ${score}/${quizQuestions.length} | |
| </p> | |
| <p class="text-gray-600 mb-6">You scored ${percentage}%</p> | |
| <div class="flex gap-4 justify-center"> | |
| <button onclick="startRandomQuiz()" class="bg-fuchsia-500 hover:bg-fuchsia-600 text-white px-6 py-3 rounded-lg font-bold transition-all duration-300"> | |
| <i data-feather="refresh-cw" class="inline mr-2"></i>Try Again | |
| </button> | |
| <button onclick="window.location.href='/lessons.html'" class="border-2 border-gray-300 hover:border-fuchsia-500 text-gray-700 px-6 py-3 rounded-lg font-bold transition-all duration-300"> | |
| <i data-feather="book" class="inline mr-2"></i>More Lessons | |
| </button> | |
| </div> | |
| `; | |
| feather.replace(); | |
| } | |
| </script> | |
| </body> | |
| </html> |