-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdf.html
More file actions
259 lines (221 loc) · 6.56 KB
/
Copy pathpdf.html
File metadata and controls
259 lines (221 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz Questions & Answers PDF | സ്വാതന്ത്ര്യദിന ക്വിസ്</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Malayalam:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Inter', 'Noto Sans Malayalam', system-ui, -apple-system, sans-serif;
}
body {
background-color: #fff;
color: #111;
padding: 15px;
line-height: 1.3;
}
.container {
max-width: 960px;
margin: 0 auto;
background: white;
padding: 10px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1.5px solid #111;
padding-bottom: 6px;
margin-bottom: 12px;
}
.header h1 {
font-size: 1.1rem;
color: #000;
font-weight: 700;
}
.meta-bar {
display: flex;
gap: 15px;
font-size: 0.8rem;
color: #444;
}
.toolbar {
display: flex;
gap: 10px;
margin-bottom: 12px;
justify-content: flex-end;
background: #f5f5f5;
padding: 6px 12px;
border-radius: 4px;
}
button {
background-color: #222;
color: white;
border: none;
padding: 5px 12px;
font-size: 0.82rem;
font-weight: 600;
border-radius: 3px;
cursor: pointer;
}
button:hover {
background-color: #444;
}
button.secondary {
background-color: #666;
}
button.secondary:hover {
background-color: #444;
}
#questions-list {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px 16px;
}
.tiebreaker-header {
grid-column: 1 / -1;
text-align: center;
font-size: 0.85rem;
font-weight: 700;
color: #000;
border-top: 1px dashed #777;
border-bottom: 1px dashed #777;
padding: 4px 0;
margin: 6px 0;
}
.qn-item {
break-inside: avoid;
page-break-inside: avoid;
padding-bottom: 6px;
border-bottom: 1px solid #eaeaea;
}
.qn-eng {
font-size: 0.83rem;
font-weight: 600;
color: #000;
margin-bottom: 2px;
}
.qn-mal {
font-size: 0.8rem;
color: #333;
margin-bottom: 3px;
}
.qn-ans {
font-size: 0.8rem;
color: #1b5e20;
font-weight: 600;
}
.hide-answers .qn-ans {
display: none !important;
}
/* Print Specific Styles */
@media print {
@page {
size: A4;
margin: 8mm 10mm;
}
body {
background: white;
padding: 0;
color: #000;
}
.container {
padding: 0;
max-width: 100%;
}
.toolbar {
display: none !important;
}
.qn-item {
border-bottom: 1px solid #ddd;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Independence Day Quiz Competition | സ്വാതന്ത്ര്യദിന ക്വിസ് മത്സരം</h1>
<div class="meta-bar">
<span>Total Questions: <strong id="total-count">25</strong></span>
<span>Date: <strong id="print-date"></strong></span>
</div>
</div>
<div class="toolbar">
<button onclick="window.print()">Print / Save as PDF</button>
<button class="secondary" onclick="toggleAnswers()" id="toggle-ans-btn">Hide Answer Key</button>
<button class="secondary" onclick="window.location.href='/'">Back to Quiz</button>
</div>
<div id="questions-list"></div>
</div>
<script>
document.getElementById('print-date').innerText = new Date().toLocaleDateString('en-US', {
year: 'numeric', month: 'short', day: 'numeric'
});
let showAnswers = true;
function toggleAnswers() {
showAnswers = !showAnswers;
const list = document.getElementById('questions-list');
const btn = document.getElementById('toggle-ans-btn');
if (showAnswers) {
list.classList.remove('hide-answers');
btn.innerText = 'Hide Answer Key';
} else {
list.classList.add('hide-answers');
btn.innerText = 'Show Answer Key';
}
}
async function loadQuestions() {
let questions = [];
try {
const res = await fetch('questions.json');
if (res.ok) {
questions = await res.json();
}
} catch(e) {}
if (!questions || questions.length === 0) {
questions = [
{
"question": "Which historic movement was launched by Mahatma Gandhi in 1942 demanding an immediate end to British rule?",
"malayalam_question": "ബ്രിട്ടീഷ് ഭരണം അവസാനിപ്പിക്കണം എന്ന് ആവശ്യപ്പെട്ട് 1942-ൽ ഗാന്ധിജി ആരംഭിച്ച ചരിത്രപ്രസിദ്ധമായ പ്രസ്ഥാനം ഏതാണ്?",
"answer": "Quit India Movement (1942)",
"malayalam_answer": "ക്വിറ്റ് ഇന്ത്യ പ്രസ്ഥാനം (1942)"
}
];
}
document.getElementById('total-count').innerText = questions.length;
const container = document.getElementById('questions-list');
let html = '';
questions.forEach((q, index) => {
const id = index + 1;
const isTieBreaker = index >= 20;
if (index === 20) {
html += `
<div class="tiebreaker-header">
Tie Breaker Round (Questions 21–${questions.length}) / ടൈ ബ്രേക്കർ റൗണ്ട്
</div>
`;
}
const label = isTieBreaker
? `Tie Breaker Q${index - 19} (Q${id})`
: `Q${id}`;
html += `
<div class="qn-item">
<div class="qn-eng"><strong>${label}.</strong> ${q.question}</div>
<div class="qn-mal"><em>ചോദ്യം ${id}.</em> ${q.malayalam_question}</div>
<div class="qn-ans"><strong>Ans:</strong> ${q.answer} | <span>${q.malayalam_answer}</span></div>
</div>
`;
});
container.innerHTML = html;
}
loadQuestions();
</script>
</body>
</html>