quiz game for why engineer day celebrate with student rugistration - Initial Deployment
Browse files- README.md +7 -5
- index.html +339 -18
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: deva
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,340 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Engineer's Day Quiz Challenge</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
|
| 9 |
+
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
<style>
|
| 13 |
+
.gradient-bg {
|
| 14 |
+
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
|
| 15 |
+
}
|
| 16 |
+
.option:hover {
|
| 17 |
+
transform: translateY(-2px);
|
| 18 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 19 |
+
}
|
| 20 |
+
.pulse {
|
| 21 |
+
animation: pulse 2s infinite;
|
| 22 |
+
}
|
| 23 |
+
@keyframes pulse {
|
| 24 |
+
0% { transform: scale(1); }
|
| 25 |
+
50% { transform: scale(1.05); }
|
| 26 |
+
100% { transform: scale(1); }
|
| 27 |
+
}
|
| 28 |
+
</style>
|
| 29 |
+
</head>
|
| 30 |
+
<body class="min-h-screen bg-gray-100">
|
| 31 |
+
<!-- Hero Section -->
|
| 32 |
+
<div id="hero" class="gradient-bg text-white py-20 px-4">
|
| 33 |
+
<div class="max-w-6xl mx-auto text-center">
|
| 34 |
+
<h1 class="text-4xl md:text-6xl font-bold mb-6" data-aos="fade-down">Engineer's Day Quiz Challenge</h1>
|
| 35 |
+
<p class="text-xl md:text-2xl mb-8" data-aos="fade-up" data-aos-delay="100">Test your knowledge about why we celebrate Engineer's Day!</p>
|
| 36 |
+
<button id="startQuizBtn" class="bg-white text-blue-600 font-bold py-3 px-8 rounded-full text-lg hover:bg-gray-100 transition-all pulse" data-aos="zoom-in" data-aos-delay="200">
|
| 37 |
+
Start Quiz Now
|
| 38 |
+
</button>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<!-- Registration Form (Hidden Initially) -->
|
| 43 |
+
<div id="registrationForm" class="hidden max-w-md mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8" data-aos="fade-up">
|
| 44 |
+
<div class="text-center mb-8">
|
| 45 |
+
<h2 class="text-2xl font-bold text-gray-800">Student Registration</h2>
|
| 46 |
+
<p class="text-gray-600">Register to participate in the quiz</p>
|
| 47 |
+
</div>
|
| 48 |
+
<form id="registerForm">
|
| 49 |
+
<div class="mb-4">
|
| 50 |
+
<label class="block text-gray-700 text-sm font-bold mb-2" for="name">
|
| 51 |
+
Full Name
|
| 52 |
+
</label>
|
| 53 |
+
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="name" type="text" placeholder="Your name" required>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="mb-4">
|
| 56 |
+
<label class="block text-gray-700 text-sm font-bold mb-2" for="email">
|
| 57 |
+
Email
|
| 58 |
+
</label>
|
| 59 |
+
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="email" type="email" placeholder="your@email.com" required>
|
| 60 |
+
</div>
|
| 61 |
+
<div class="mb-4">
|
| 62 |
+
<label class="block text-gray-700 text-sm font-bold mb-2" for="college">
|
| 63 |
+
College/University
|
| 64 |
+
</label>
|
| 65 |
+
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="college" type="text" placeholder="Institution name" required>
|
| 66 |
+
</div>
|
| 67 |
+
<div class="mb-6">
|
| 68 |
+
<label class="block text-gray-700 text-sm font-bold mb-2" for="department">
|
| 69 |
+
Engineering Department
|
| 70 |
+
</label>
|
| 71 |
+
<select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="department" required>
|
| 72 |
+
<option value="">Select your department</option>
|
| 73 |
+
<option value="Computer">Computer Engineering</option>
|
| 74 |
+
<option value="Mechanical">Mechanical Engineering</option>
|
| 75 |
+
<option value="Electrical">Electrical Engineering</option>
|
| 76 |
+
<option value="Civil">Civil Engineering</option>
|
| 77 |
+
<option value="Electronics">Electronics Engineering</option>
|
| 78 |
+
<option value="Other">Other</option>
|
| 79 |
+
</select>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="flex items-center justify-between">
|
| 82 |
+
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full" type="submit">
|
| 83 |
+
Register & Start Quiz
|
| 84 |
+
</button>
|
| 85 |
+
</div>
|
| 86 |
+
</form>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<!-- Quiz Container (Hidden Initially) -->
|
| 90 |
+
<div id="quizContainer" class="hidden max-w-3xl mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8">
|
| 91 |
+
<div class="flex justify-between items-center mb-8">
|
| 92 |
+
<div class="text-lg font-semibold text-gray-700">Question <span id="currentQuestion">1</span>/10</div>
|
| 93 |
+
<div class="text-lg font-semibold text-gray-700">Score: <span id="score">0</span></div>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div id="question" class="text-xl font-bold mb-8 text-gray-800"></div>
|
| 97 |
+
|
| 98 |
+
<div id="options" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
|
| 99 |
+
<!-- Options will be inserted here by JavaScript -->
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<div class="flex justify-between">
|
| 103 |
+
<button id="prevBtn" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded hidden">
|
| 104 |
+
Previous
|
| 105 |
+
</button>
|
| 106 |
+
<button id="nextBtn" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
| 107 |
+
Next
|
| 108 |
+
</button>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<!-- Results Container (Hidden Initially) -->
|
| 113 |
+
<div id="resultsContainer" class="hidden max-w-md mx-auto my-16 bg-white rounded-xl shadow-md overflow-hidden p-8 text-center">
|
| 114 |
+
<div class="mb-8">
|
| 115 |
+
<i data-feather="award" class="w-16 h-16 text-yellow-500 mx-auto mb-4"></i>
|
| 116 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-2">Quiz Completed!</h2>
|
| 117 |
+
<p class="text-gray-600 mb-4">Congratulations on completing the Engineer's Day Quiz</p>
|
| 118 |
+
<div class="text-4xl font-bold text-blue-600 mb-6">Your Score: <span id="finalScore">0</span>/10</div>
|
| 119 |
+
<div id="certificateBtn" class="bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-6 rounded-full inline-block cursor-pointer">
|
| 120 |
+
Download Your Certificate
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
<div class="border-t pt-6">
|
| 124 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Why We Celebrate Engineer's Day</h3>
|
| 125 |
+
<p class="text-gray-600 mb-4 text-left">
|
| 126 |
+
Engineer's Day is celebrated on September 15th in India to commemorate the birth anniversary of the legendary engineer Sir M. Visvesvaraya, who made outstanding contributions to engineering and nation-building.
|
| 127 |
+
</p>
|
| 128 |
+
<p class="text-gray-600 text-left">
|
| 129 |
+
This day recognizes the achievements of engineers and their role in technological advancement and societal development.
|
| 130 |
+
</p>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<script>
|
| 135 |
+
// Initialize AOS and Feather Icons
|
| 136 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 137 |
+
AOS.init({
|
| 138 |
+
duration: 800,
|
| 139 |
+
easing: 'ease-in-out',
|
| 140 |
+
once: true
|
| 141 |
+
});
|
| 142 |
+
feather.replace();
|
| 143 |
+
|
| 144 |
+
// Quiz questions
|
| 145 |
+
const questions = [
|
| 146 |
+
{
|
| 147 |
+
question: "On which date is Engineer's Day celebrated in India?",
|
| 148 |
+
options: ["September 15", "October 5", "November 20", "December 25"],
|
| 149 |
+
answer: 0
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
question: "Engineer's Day in India commemorates the birth anniversary of which famous engineer?",
|
| 153 |
+
options: ["A.P.J. Abdul Kalam", "C.V. Raman", "M. Visvesvaraya", "Homi Bhabha"],
|
| 154 |
+
answer: 2
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
question: "In which year was Sir M. Visvesvaraya awarded the Bharat Ratna?",
|
| 158 |
+
options: ["1945", "1955", "1965", "1975"],
|
| 159 |
+
answer: 1
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
question: "Which of these engineering marvels is Sir M. Visvesvaraya known for?",
|
| 163 |
+
options: ["Taj Mahal", "Krishna Raja Sagara Dam", "Qutub Minar", "Gateway of India"],
|
| 164 |
+
answer: 1
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
question: "What was Sir M. Visvesvaraya's profession before becoming an engineer?",
|
| 168 |
+
options: ["Doctor", "Teacher", "Farmer", "He was always an engineer"],
|
| 169 |
+
answer: 1
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
question: "Which country celebrates Engineer's Day on the same date as India?",
|
| 173 |
+
options: ["Sri Lanka", "Singapore", "Germany", "None of these"],
|
| 174 |
+
answer: 0
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
question: "What was Sir M. Visvesvaraya's contribution to flood protection?",
|
| 178 |
+
options: ["Invented the first dam", "Developed automatic sluice gates", "Created flood warning systems", "All of the above"],
|
| 179 |
+
answer: 1
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
question: "Which engineering college did Sir M. Visvesvaraya help establish?",
|
| 183 |
+
options: ["IIT Bombay", "College of Engineering, Pune", "University Visvesvaraya College of Engineering", "BITS Pilani"],
|
| 184 |
+
answer: 2
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
question: "What was Sir M. Visvesvaraya's role in Mysore state?",
|
| 188 |
+
options: ["King", "Chief Engineer", "Diwan (Prime Minister)", "Court Jester"],
|
| 189 |
+
answer: 2
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
question: "What is the theme of Engineer's Day 2023?",
|
| 193 |
+
options: ["Engineering for Sustainable Development", "Engineering Innovations for a Better World", "Engineering Solutions for Climate Change", "The official theme hasn't been announced yet"],
|
| 194 |
+
answer: 3
|
| 195 |
+
}
|
| 196 |
+
];
|
| 197 |
+
|
| 198 |
+
// Quiz variables
|
| 199 |
+
let currentQuestionIndex = 0;
|
| 200 |
+
let score = 0;
|
| 201 |
+
let userAnswers = [];
|
| 202 |
+
let userData = {};
|
| 203 |
+
|
| 204 |
+
// DOM elements
|
| 205 |
+
const startQuizBtn = document.getElementById('startQuizBtn');
|
| 206 |
+
const registrationForm = document.getElementById('registrationForm');
|
| 207 |
+
const registerForm = document.getElementById('registerForm');
|
| 208 |
+
const quizContainer = document.getElementById('quizContainer');
|
| 209 |
+
const resultsContainer = document.getElementById('resultsContainer');
|
| 210 |
+
const questionElement = document.getElementById('question');
|
| 211 |
+
const optionsElement = document.getElementById('options');
|
| 212 |
+
const currentQuestionElement = document.getElementById('currentQuestion');
|
| 213 |
+
const scoreElement = document.getElementById('score');
|
| 214 |
+
const finalScoreElement = document.getElementById('finalScore');
|
| 215 |
+
const prevBtn = document.getElementById('prevBtn');
|
| 216 |
+
const nextBtn = document.getElementById('nextBtn');
|
| 217 |
+
const certificateBtn = document.getElementById('certificateBtn');
|
| 218 |
+
|
| 219 |
+
// Event listeners
|
| 220 |
+
startQuizBtn.addEventListener('click', showRegistrationForm);
|
| 221 |
+
registerForm.addEventListener('submit', startQuiz);
|
| 222 |
+
nextBtn.addEventListener('click', nextQuestion);
|
| 223 |
+
prevBtn.addEventListener('click', prevQuestion);
|
| 224 |
+
certificateBtn.addEventListener('click', generateCertificate);
|
| 225 |
+
|
| 226 |
+
// Show registration form
|
| 227 |
+
function showRegistrationForm() {
|
| 228 |
+
document.getElementById('hero').classList.add('hidden');
|
| 229 |
+
registrationForm.classList.remove('hidden');
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// Start quiz after registration
|
| 233 |
+
function startQuiz(e) {
|
| 234 |
+
e.preventDefault();
|
| 235 |
+
|
| 236 |
+
// Save user data
|
| 237 |
+
userData = {
|
| 238 |
+
name: document.getElementById('name').value,
|
| 239 |
+
email: document.getElementById('email').value,
|
| 240 |
+
college: document.getElementById('college').value,
|
| 241 |
+
department: document.getElementById('department').value
|
| 242 |
+
};
|
| 243 |
+
|
| 244 |
+
registrationForm.classList.add('hidden');
|
| 245 |
+
quizContainer.classList.remove('hidden');
|
| 246 |
+
loadQuestion();
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
// Load current question
|
| 250 |
+
function loadQuestion() {
|
| 251 |
+
const question = questions[currentQuestionIndex];
|
| 252 |
+
questionElement.textContent = question.question;
|
| 253 |
+
currentQuestionElement.textContent = currentQuestionIndex + 1;
|
| 254 |
+
scoreElement.textContent = score;
|
| 255 |
+
|
| 256 |
+
// Clear previous options
|
| 257 |
+
optionsElement.innerHTML = '';
|
| 258 |
+
|
| 259 |
+
// Add new options
|
| 260 |
+
question.options.forEach((option, index) => {
|
| 261 |
+
const optionElement = document.createElement('div');
|
| 262 |
+
optionElement.className = 'option bg-white border border-gray-200 rounded-lg p-4 cursor-pointer transition-all hover:border-blue-500';
|
| 263 |
+
optionElement.innerHTML = `
|
| 264 |
+
<div class="flex items-center">
|
| 265 |
+
<div class="w-6 h-6 rounded-full border border-gray-300 mr-3 flex items-center justify-center">${String.fromCharCode(65 + index)}</div>
|
| 266 |
+
<div>${option}</div>
|
| 267 |
+
</div>
|
| 268 |
+
`;
|
| 269 |
+
|
| 270 |
+
// Check if user has already answered this question
|
| 271 |
+
if (userAnswers[currentQuestionIndex] !== undefined) {
|
| 272 |
+
if (userAnswers[currentQuestionIndex] === index) {
|
| 273 |
+
optionElement.classList.add('bg-blue-50', 'border-blue-500');
|
| 274 |
+
}
|
| 275 |
+
optionElement.classList.add('pointer-events-none');
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
optionElement.addEventListener('click', () => selectAnswer(index));
|
| 279 |
+
optionsElement.appendChild(optionElement);
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
// Update navigation buttons
|
| 283 |
+
prevBtn.classList.toggle('hidden', currentQuestionIndex === 0);
|
| 284 |
+
nextBtn.textContent = currentQuestionIndex === questions.length - 1 ? 'Finish' : 'Next';
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
// Select answer
|
| 288 |
+
function selectAnswer(index) {
|
| 289 |
+
// If already answered, do nothing
|
| 290 |
+
if (userAnswers[currentQuestionIndex] !== undefined) return;
|
| 291 |
+
|
| 292 |
+
// Mark answer
|
| 293 |
+
userAnswers[currentQuestionIndex] = index;
|
| 294 |
+
|
| 295 |
+
// Highlight selected option
|
| 296 |
+
const options = optionsElement.querySelectorAll('.option');
|
| 297 |
+
options.forEach(option => option.classList.remove('bg-blue-50', 'border-blue-500'));
|
| 298 |
+
options[index].classList.add('bg-blue-50', 'border-blue-500');
|
| 299 |
+
|
| 300 |
+
// Check if correct
|
| 301 |
+
if (index === questions[currentQuestionIndex].answer) {
|
| 302 |
+
score++;
|
| 303 |
+
scoreElement.textContent = score;
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
// Next question
|
| 308 |
+
function nextQuestion() {
|
| 309 |
+
// If last question, show results
|
| 310 |
+
if (currentQuestionIndex === questions.length - 1) {
|
| 311 |
+
showResults();
|
| 312 |
+
return;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// Move to next question
|
| 316 |
+
currentQuestionIndex++;
|
| 317 |
+
loadQuestion();
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
// Previous question
|
| 321 |
+
function prevQuestion() {
|
| 322 |
+
currentQuestionIndex--;
|
| 323 |
+
loadQuestion();
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
// Show results
|
| 327 |
+
function showResults() {
|
| 328 |
+
quizContainer.classList.add('hidden');
|
| 329 |
+
resultsContainer.classList.remove('hidden');
|
| 330 |
+
finalScoreElement.textContent = score;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// Generate certificate (simulated)
|
| 334 |
+
function generateCertificate() {
|
| 335 |
+
alert(`Certificate generated for ${userData.name}!\n(Simulated function - in a real app, this would generate a PDF)`);
|
| 336 |
+
}
|
| 337 |
+
});
|
| 338 |
+
</script>
|
| 339 |
+
</body>
|
| 340 |
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
quiz game for why engineer day celebrate with student rugistration
|