dfdsdfgfd commited on
Commit
a6c4032
·
verified ·
1 Parent(s): 7179683

Initial DeepSite commit

Browse files
Files changed (2) hide show
  1. README.md +9 -6
  2. index.html +780 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Deepsite Project E9jcs
3
- emoji: 🦀
4
- colorFrom: purple
5
- colorTo: purple
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: DeepSite Project
3
+ colorFrom: red
4
+ colorTo: yellow
 
5
  sdk: static
6
+ emoji: 🛠️
7
+ tags:
8
+ - deepsite-v4
9
  ---
10
 
11
+ # DeepSite Project
12
+
13
+ This project has been created with [DeepSite](https://deepsite.hf.co) AI Vibe Coding.
index.html CHANGED
@@ -1,19 +1,780 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" dir="ltr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Punjab Board Paper Generator - BISE Gujranwala</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/lucide@latest"></script>
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
11
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Nastaliq+Urdu&display=swap" rel="stylesheet">
12
+ <style>
13
+ body {
14
+ font-family: 'Inter', sans-serif;
15
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
16
+ min-height: 100vh;
17
+ }
18
+ .urdu-text {
19
+ font-family: 'Noto Nastaliq Urdu', serif;
20
+ line-height: 2.5;
21
+ }
22
+ .paper-sheet {
23
+ background: white;
24
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
25
+ min-height: 297mm;
26
+ }
27
+ .subject-card {
28
+ transition: all 0.3s ease;
29
+ cursor: pointer;
30
+ }
31
+ .subject-card:hover {
32
+ transform: translateY(-5px);
33
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
34
+ }
35
+ .subject-card.active {
36
+ border-color: #667eea;
37
+ background-color: #f0f4ff;
38
+ transform: scale(1.05);
39
+ }
40
+ @media print {
41
+ body { background: white; }
42
+ .no-print { display: none !important; }
43
+ .paper-sheet { box-shadow: none; }
44
+ }
45
+ .section-divider {
46
+ border-top: 2px dashed #cbd5e1;
47
+ margin: 2rem 0;
48
+ }
49
+ .question-edit:focus {
50
+ outline: 2px solid #667eea;
51
+ background-color: #f8fafc;
52
+ padding: 0.5rem;
53
+ border-radius: 0.375rem;
54
+ }
55
+ .gradient-text {
56
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
57
+ -webkit-background-clip: text;
58
+ -webkit-text-fill-color: transparent;
59
+ }
60
+ </style>
61
+ </head>
62
+ <body class="p-4 md:p-8">
63
+
64
+ <!-- Header -->
65
+ <header class="no-print text-white mb-8 text-center">
66
+ <div class="flex justify-center items-center gap-3 mb-2">
67
+ <i data-lucide="file-text" class="w-10 h-10"></i>
68
+ <h1 class="text-3xl md:text-4xl font-bold">Punjab Board Paper Generator</h1>
69
+ </div>
70
+ <p class="text-white/80 text-lg">BISE Gujranwala | 9th & 10th Class Examination System</p>
71
+ <div class="mt-2 text-sm text-white/60">بورڈ آف انٹرمیڈیٹ اینڈ سیکنڈری ایجوکیشن گوجرانوالہ</div>
72
+ </header>
73
+
74
+ <!-- Main Container -->
75
+ <div class="max-w-6xl mx-auto">
76
+
77
+ <!-- Control Panel -->
78
+ <div class="no-print bg-white rounded-2xl shadow-xl p-6 mb-8">
79
+ <!-- Grade Selection -->
80
+ <div class="mb-6">
81
+ <label class="block text-sm font-semibold text-gray-700 mb-3 uppercase tracking-wide">Select Grade</label>
82
+ <div class="flex gap-4">
83
+ <button onclick="selectGrade('9th')" id="grade-9th" class="grade-btn flex-1 py-3 px-6 rounded-xl border-2 border-gray-200 font-semibold text-gray-600 hover:border-indigo-500 hover:text-indigo-600 transition-all">
84
+ 9th Class
85
+ </button>
86
+ <button onclick="selectGrade('10th')" id="grade-10th" class="grade-btn flex-1 py-3 px-6 rounded-xl border-2 border-gray-200 font-semibold text-gray-600 hover:border-indigo-500 hover:text-indigo-600 transition-all">
87
+ 10th Class
88
+ </button>
89
+ </div>
90
+ </div>
91
+
92
+ <!-- Subject Selection -->
93
+ <div class="mb-6">
94
+ <label class="block text-sm font-semibold text-gray-700 mb-3 uppercase tracking-wide">Select Subject</label>
95
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4" id="subject-grid">
96
+ <div onclick="selectSubject('Mathematics')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Mathematics">
97
+ <i data-lucide="calculator" class="w-8 h-8 mx-auto mb-2 text-blue-600"></i>
98
+ <div class="font-semibold text-sm">Mathematics</div>
99
+ <div class="text-xs text-gray-500 mt-1">ریاضی</div>
100
+ </div>
101
+ <div onclick="selectSubject('Physics')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Physics">
102
+ <i data-lucide="atom" class="w-8 h-8 mx-auto mb-2 text-purple-600"></i>
103
+ <div class="font-semibold text-sm">Physics</div>
104
+ <div class="text-xs text-gray-500 mt-1">فزکس</div>
105
+ </div>
106
+ <div onclick="selectSubject('Chemistry')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Chemistry">
107
+ <i data-lucide="flask-conical" class="w-8 h-8 mx-auto mb-2 text-green-600"></i>
108
+ <div class="font-semibold text-sm">Chemistry</div>
109
+ <div class="text-xs text-gray-500 mt-1">کیمسٹری</div>
110
+ </div>
111
+ <div onclick="selectSubject('Biology')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Biology">
112
+ <i data-lucide="leaf" class="w-8 h-8 mx-auto mb-2 text-emerald-600"></i>
113
+ <div class="font-semibold text-sm">Biology</div>
114
+ <div class="text-xs text-gray-500 mt-1">حیاتیات</div>
115
+ </div>
116
+ <div onclick="selectSubject('Computer Science')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Computer Science">
117
+ <i data-lucide="monitor" class="w-8 h-8 mx-auto mb-2 text-indigo-600"></i>
118
+ <div class="font-semibold text-sm">Computer Science</div>
119
+ <div class="text-xs text-gray-500 mt-1">کمپیوٹر سائنس</div>
120
+ </div>
121
+ <div onclick="selectSubject('Islamiyat')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Islamiyat">
122
+ <i data-lucide="book-open" class="w-8 h-8 mx-auto mb-2 text-teal-600"></i>
123
+ <div class="font-semibold text-sm">Islamiyat</div>
124
+ <div class="text-xs text-gray-500 mt-1">اسلامیات</div>
125
+ </div>
126
+ <div onclick="selectSubject('Pakistan Studies')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="Pakistan Studies">
127
+ <i data-lucide="map" class="w-8 h-8 mx-auto mb-2 text-red-600"></i>
128
+ <div class="font-semibold text-sm">Pakistan Studies</div>
129
+ <div class="text-xs text-gray-500 mt-1">پاکستان اسٹڈیز</div>
130
+ </div>
131
+ <div onclick="selectSubject('English')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center" data-subject="English">
132
+ <i data-lucide="languages" class="w-8 h-8 mx-auto mb-2 text-orange-600"></i>
133
+ <div class="font-semibold text-sm">English</div>
134
+ <div class="text-xs text-gray-500 mt-1">انگلش</div>
135
+ </div>
136
+ <div onclick="selectSubject('Urdu')" class="subject-card border-2 border-gray-200 rounded-xl p-4 text-center col-span-2 md:col-span-1" data-subject="Urdu">
137
+ <i data-lucide="pen-tool" class="w-8 h-8 mx-auto mb-2 text-pink-600"></i>
138
+ <div class="font-semibold text-sm">Urdu</div>
139
+ <div class="text-xs text-gray-500 mt-1">اردو</div>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <!-- Paper Version Selection -->
145
+ <div class="mb-6">
146
+ <label class="block text-sm font-semibold text-gray-700 mb-3 uppercase tracking-wide">Paper Version</label>
147
+ <div class="flex gap-2 flex-wrap">
148
+ <button onclick="selectVersion('A')" id="version-A" class="version-btn px-4 py-2 rounded-lg border-2 border-indigo-500 bg-indigo-50 text-indigo-700 font-semibold text-sm">Set A</button>
149
+ <button onclick="selectVersion('B')" id="version-B" class="version-btn px-4 py-2 rounded-lg border-2 border-gray-200 text-gray-600 font-semibold text-sm hover:border-indigo-300">Set B</button>
150
+ <button onclick="selectVersion('C')" id="version-C" class="version-btn px-4 py-2 rounded-lg border-2 border-gray-200 text-gray-600 font-semibold text-sm hover:border-indigo-300">Set C</button>
151
+ </div>
152
+ </div>
153
+
154
+ <!-- Options -->
155
+ <div class="mb-6 flex flex-wrap gap-4 items-center">
156
+ <label class="flex items-center gap-2 cursor-pointer">
157
+ <input type="checkbox" id="include-answer-key" class="w-5 h-5 text-indigo-600 rounded focus:ring-indigo-500" onchange="toggleAnswerKey()">
158
+ <span class="text-sm font-medium text-gray-700">Include Answer Key</span>
159
+ </label>
160
+ <label class="flex items-center gap-2 cursor-pointer">
161
+ <input type="checkbox" id="exam-timer" class="w-5 h-5 text-indigo-600 rounded focus:ring-indigo-500">
162
+ <span class="text-sm font-medium text-gray-700">Enable Exam Timer (2:30h)</span>
163
+ </label>
164
+ </div>
165
+
166
+ <!-- Student Info -->
167
+ <div class="mb-6 bg-gray-50 rounded-xl p-4 border-2 border-gray-200">
168
+ <label class="block text-sm font-semibold text-gray-700 mb-3 uppercase tracking-wide">Student Information (Optional)</label>
169
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
170
+ <input type="text" id="student-name" placeholder="Student Name" class="w-full px-4 py-2 rounded-lg border-2 border-gray-300 focus:border-indigo-500 focus:outline-none text-sm">
171
+ <input type="text" id="roll-number" placeholder="Roll Number" class="w-full px-4 py-2 rounded-lg border-2 border-gray-300 focus:border-indigo-500 focus:outline-none text-sm">
172
+ <input type="date" id="exam-date" class="w-full px-4 py-2 rounded-lg border-2 border-gray-300 focus:border-indigo-500 focus:outline-none text-sm">
173
+ </div>
174
+ </div>
175
+
176
+ <!-- Action Buttons -->
177
+ <div class="flex gap-3 flex-wrap">
178
+ <button onclick="generatePaper()" class="flex-1 bg-gradient-to-r from-indigo-600 to-purple-600 text-white py-3 px-6 rounded-xl font-semibold hover:shadow-lg transform hover:scale-105 transition-all flex items-center justify-center gap-2">
179
+ <i data-lucide="file-plus"></i>
180
+ Generate Paper
181
+ </button>
182
+ <button onclick="downloadPDF()" class="flex-1 bg-red-600 text-white py-3 px-6 rounded-xl font-semibold hover:bg-red-700 transition-all flex items-center justify-center gap-2">
183
+ <i data-lucide="file-down"></i>
184
+ Download PDF
185
+ </button>
186
+ <button onclick="printPaper()" class="px-6 py-3 bg-gray-800 text-white rounded-xl font-semibold hover:bg-gray-900 transition-all flex items-center justify-center gap-2">
187
+ <i data-lucide="printer"></i>
188
+ </button>
189
+ <button onclick="savePaper()" class="px-6 py-3 bg-green-600 text-white rounded-xl font-semibold hover:bg-green-700 transition-all flex items-center justify-center gap-2" title="Save to Local Storage">
190
+ <i data-lucide="save"></i>
191
+ </button>
192
+ <button onclick="resetForm()" class="px-6 py-3 border-2 border-gray-300 rounded-xl font-semibold text-gray-600 hover:border-gray-400 transition-all">
193
+ <i data-lucide="rotate-ccw"></i>
194
+ </button>
195
+ </div>
196
+
197
+ <!-- Saved Papers Section -->
198
+ <div id="saved-papers-section" class="mt-6 pt-6 border-t-2 border-gray-200 hidden">
199
+ <div class="flex justify-between items-center mb-3">
200
+ <label class="block text-sm font-semibold text-gray-700 uppercase tracking-wide">Saved Papers</label>
201
+ <button onclick="clearAllSaved()" class="text-xs text-red-600 hover:text-red-800 underline">Clear All</button>
202
+ </div>
203
+ <div id="saved-papers-list" class="grid grid-cols-1 md:grid-cols-2 gap-3 max-h-40 overflow-y-auto"></div>
204
+ </div>
205
+ </div>
206
+
207
+ <!-- Timer Display (Exam Mode) -->
208
+ <div id="timer-display" class="hidden no-print fixed top-4 right-4 bg-black text-white px-6 py-3 rounded-xl shadow-2xl z-40 border-2 border-indigo-500">
209
+ <div class="text-xs uppercase tracking-widest mb-1 text-gray-400">Time Remaining</div>
210
+ <div class="text-2xl font-mono font-bold" id="timer-count">02:30:00</div>
211
+ <button onclick="stopTimer()" class="mt-2 text-xs bg-red-600 hover:bg-red-700 px-3 py-1 rounded transition-colors">Stop Timer</button>
212
+ </div>
213
+
214
+ <!-- Paper Display Area -->
215
+ <div id="paper-container" class="hidden">
216
+ <!-- Student Info Display (on paper) -->
217
+ <div class="paper-sheet rounded-lg p-8 md:p-12 mb-8 text-gray-900" id="main-paper">
218
+ <!-- Paper Header -->
219
+ <div class="text-center border-b-4 border-double border-gray-800 pb-6 mb-6">
220
+ <div class="text-xs uppercase tracking-widest mb-1 text-gray-600">Set <span id="paper-version-display">A</span></div>
221
+ <div class="text-sm font-bold uppercase tracking-widest mb-2">Board of Intermediate & Secondary Education Gujranwala</div>
222
+ <div class="text-2xl font-bold mb-2 gradient-text">Punjab Board Examination Paper</div>
223
+
224
+ <!-- Student Info on Paper -->
225
+ <div class="grid grid-cols-3 gap-4 mt-4 mb-4 p-3 bg-gray-50 rounded-lg border-2 border-gray-300 text-left">
226
+ <div><span class="font-bold text-gray-600">Student Name:</span> <span id="display-student-name" class="font-semibold border-b-2 border-gray-400 px-2 min-w-[100px] inline-block">_________________</span></div>
227
+ <div><span class="font-bold text-gray-600">Roll No:</span> <span id="display-roll-number" class="font-semibold border-b-2 border-gray-400 px-2 min-w-[80px] inline-block">__________</span></div>
228
+ <div><span class="font-bold text-gray-600">Date:</span> <span id="display-exam-date" class="font-semibold border-b-2 border-gray-400 px-2 min-w-[100px] inline-block">__________</span></div>
229
+ </div>
230
+
231
+ <div class="grid grid-cols-3 gap-4 mt-2 text-left border-t pt-4">
232
+ <div><span class="font-bold">Class:</span> <span id="paper-grade" class="font-semibold text-indigo-700"></span></div>
233
+ <div><span class="font-bold">Subject:</span> <span id="paper-subject" class="font-semibold text-indigo-700"></span></div>
234
+ <div><span class="font-bold">Total Marks:</span> 75</div>
235
+ </div>
236
+ <div class="grid grid-cols-2 gap-4 mt-2 text-left border-b pb-4">
237
+ <div><span class="font-bold">Time:</span> 2 Hours 30 Minutes</div>
238
+ <div class="text-right"><span class="font-bold">Session:</span> Annual Examination 2024</div>
239
+ </div>
240
+ </div>
241
+
242
+ <!-- Paper Content -->
243
+ <div id="paper-content" class="prose max-w-none"></div>
244
+
245
+ <!-- Footer -->
246
+ <div class="mt-12 pt-6 border-t-2 border-gray-300 text-center text-sm text-gray-500 italic">
247
+ <p>End of Question Paper | تمام سوالات حل کریں</p>
248
+ <p class="mt-1 text-xs">Good Luck! | کامیابی کیلئے نیک تمنائیں</p>
249
+ </div>
250
+ </div>
251
+
252
+ <!-- Answer Key Section (Hidden by default) -->
253
+ <div id="answer-key-section" class="paper-sheet rounded-lg p-8 md:p-12 mb-8 text-gray-900 hidden" style="background: #fef3c7;">
254
+ <div class="text-center border-b-4 border-double border-green-700 pb-6 mb-6">
255
+ <div class="text-2xl font-bold mb-2 text-green-800">ANSWER KEY / حل نامہ</div>
256
+ <div class="text-sm font-bold uppercase tracking-widest mb-2 text-green-700">Confidential - For Teachers Only</div>
257
+ <div class="grid grid-cols-3 gap-4 mt-4 text-left border-t pt-4">
258
+ <div><span class="font-bold">Class:</span> <span id="answer-grade" class="font-semibold text-green-700"></span></div>
259
+ <div><span class="font-bold">Subject:</span> <span id="answer-subject" class="font-semibold text-green-700"></span></div>
260
+ <div><span class="font-bold">Set:</span> <span id="answer-version" class="font-bold text-green-700">A</span></div>
261
+ </div>
262
+ </div>
263
+ <div id="answer-content" class="prose max-w-none"></div>
264
+ <div class="mt-8 pt-6 border-t-2 border-green-200 text-center text-xs text-green-700">
265
+ <p>Note: This answer key is generated automatically and should be reviewed by subject teachers before finalization.</p>
266
+ </div>
267
+ </div>
268
+ </div>
269
+
270
+ <!-- Empty State -->
271
+ <div id="empty-state" class="no-print text-center text-white py-20">
272
+ <i data-lucide="clipboard-list" class="w-24 h-24 mx-auto mb-4 opacity-50"></i>
273
+ <p class="text-xl opacity-80">Select Grade and Subject to Generate Paper</p>
274
+ <p class="text-sm opacity-60 mt-2">گریڈ اور مضمون منتخب کریں</p>
275
+ </div>
276
+
277
+ </div>
278
+
279
+ <!-- Edit Modal -->
280
+ <div id="edit-modal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4">
281
+ <div class="bg-white rounded-2xl max-w-lg w-full p-6 transform scale-100 transition-transform">
282
+ <h3 class="text-xl font-bold mb-4 flex items-center gap-2">
283
+ <i data-lucide="edit-3" class="text-indigo-600"></i>
284
+ Customize Question
285
+ </h3>
286
+ <div class="mb-4">
287
+ <label class="block text-sm font-bold text-gray-700 mb-2">Original Question:</label>
288
+ <div id="original-question" class="bg-gray-100 p-3 rounded-lg text-gray-600 text-sm italic"></div>
289
+ </div>
290
+ <div class="mb-6">
291
+ <label class="block text-sm font-bold text-gray-700 mb-2">Updated Question:</label>
292
+ <textarea id="updated-question" rows="3" class="w-full border-2 border-gray-200 rounded-lg p-3 focus:border-indigo-500 focus:outline-none resize-none"></textarea>
293
+ </div>
294
+ <div class="flex gap-3 justify-end">
295
+ <button onclick="closeEditModal()" class="px-4 py-2 text-gray-600 hover:text-gray-800 font-semibold">Cancel</button>
296
+ <button onclick="saveQuestionEdit()" class="px-6 py-2 bg-indigo-600 text-white rounded-lg font-semibold hover:bg-indigo-700 transition-colors">Save Changes</button>
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <script>
302
+ // Initialize Lucide icons
303
+ lucide.createIcons();
304
+
305
+ // State Management
306
+ let currentGrade = null;
307
+ let currentSubject = null;
308
+ let currentEditTarget = null;
309
+ let currentVersion = 'A';
310
+ let timerInterval = null;
311
+ let answerKeyMode = false;
312
+
313
+ // Question Bank Database
314
+ const questionBank = {
315
+ "Mathematics": {
316
+ mcqs: [
317
+ { q: "What is the value of π (pi) approximately?", options: ["3.14", "3.41", "3.12", "3.24"], answer: "A" },
318
+ { q: "The solution of equation x² - 5x + 6 = 0 is:", options: ["2, 3", "3, 4", "1, 6", "2, 4"], answer: "A" },
319
+ { q: "If log₂x = 3, then x = ?", options: ["6", "8", "9", "12"], answer: "B" },
320
+ { q: "The distance between points (0,0) and (3,4) is:", options: ["5", "7", "12", "25"], answer: "A" },
321
+ { q: "sin²θ + cos²θ = ?", options: ["0", "1", "2", "sinθ"], answer: "B" }
322
+ ],
323
+ shortQuestions: [
324
+ "Define rational number and give two examples.",
325
+ "Find the HCF of 12 and 18.",
326
+ "Solve: 2x + 5 = 15",
327
+ "What is the formula for area of circle?",
328
+ "Define Pythagoras theorem.",
329
+ "Convert 45° to radians.",
330
+ "Find the slope of line passing through (2,3) and (4,7).",
331
+ "What is the quadratic formula?",
332
+ "Define arithmetic progression."
333
+ ],
334
+ longQuestions: [
335
+ { q: "Prove that √2 is irrational.", marks: 8 },
336
+ { q: "Solve the system of equations: 2x + 3y = 7 and x - y = 1", marks: 8 },
337
+ { q: "Prove Pythagoras theorem with diagram.", marks: 8 },
338
+ { q: "Find the roots of equation: x² - 7x + 12 = 0 using quadratic formula.", marks: 8 }
339
+ ]
340
+ },
341
+ "Physics": {
342
+ mcqs: [
343
+ { q: "SI unit of force is:", options: ["Newton", "Joule", "Watt", "Pascal"], answer: "A" },
344
+ { q: "Acceleration due to gravity on Earth is approximately:", options: ["10 m/s²", "9.8 m/s²", "8.9 m/s²", "12 m/s²"], answer: "B" },
345
+ { q: "Velocity is:", options: ["Scalar", "Vector", "Constant", "None"], answer: "B" }
346
+ ],
347
+ shortQuestions: [
348
+ "Define velocity and speed. Differentiate between them.",
349
+ "State Newton's first law of motion.",
350
+ "What is the law of conservation of energy?",
351
+ "Define Ohm's law.",
352
+ "What is meant by 1 Watt power?"
353
+ ],
354
+ longQuestions: [
355
+ { q: "Derive equations of motion for uniformly accelerated motion.", marks: 8 },
356
+ { q: "Explain Newton's three laws of motion with examples.", marks: 8 }
357
+ ]
358
+ }
359
+ };
360
+
361
+ // Punjab Board Class Implementation
362
+ class PunjabGujranwalaBoard {
363
+ constructor() {
364
+ this.generalSubjects = [
365
+ "Mathematics", "Physics", "Chemistry", "Biology",
366
+ "Computer Science", "Islamiyat", "Pakistan Studies"
367
+ ];
368
+ this.languageSubjects = ["English", "Urdu"];
369
+ }
370
+
371
+ generatePaper({ grade, subject }) {
372
+ if (subject === "English") {
373
+ return this.getEnglishStructure(grade);
374
+ }
375
+ if (subject === "Urdu") {
376
+ return this.getUrduStructure(grade);
377
+ }
378
+ if (this.generalSubjects.includes(subject)) {
379
+ return this.getGeneralStructure(grade, subject);
380
+ }
381
+ return "Subject not recognized.";
382
+ }
383
+
384
+ getEnglishStructure(grade) {
385
+ return {
386
+ header: {
387
+ board: "Board of Intermediate & Secondary Education Gujranwala",
388
+ class: grade,
389
+ subject: "English",
390
+ marks: 75,
391
+ time: "2:30 Hours"
392
+ },
393
+ sections: [
394
+ {
395
+ title: "SECTION A – MCQs",
396
+ marks: 12,
397
+ content: [
398
+ "12 Objective Questions from:",
399
+ "• Grammar & Vocabulary",
400
+ "• Comprehension Passage",
401
+ "• Synonyms/Antonyms",
402
+ "Choose the correct option (A/B/C/D)"
403
+ ]
404
+ },
405
+ {
406
+ title: "SECTION B – Short Questions",
407
+ portions: [
408
+ { name: "Portion I", desc: "9 Short Questions from Text Book (Attempt any 6)", marks: "2 marks each" },
409
+ { name: "Portion II", desc: "9 Short Questions from Grammar Section (Attempt any 6)", marks: "2 marks each" },
410
+ { name: "Portion III", desc: "9 Short Questions from Translation/Paragraph (Attempt any 6)", marks: "2 marks each" }
411
+ ],
412
+ note: "Attempt any TWO portions completely"
413
+ },
414
+ {
415
+ title: "SECTION C – Long Questions",
416
+ questions: [
417
+ "1. Essay Writing (Choose 1 out of 3 topics) – [10 Marks]",
418
+ "2. Letter/Application Writing (Formal/Informal) – [8 Marks]",
419
+ "3. Comprehension Passage with long questions – [10 Marks]",
420
+ "4. Translation (Urdu to English or English to Urdu) – [8 Marks]"
421
+ ]
422
+ }
423
+ ],
424
+ instructions: [
425
+ "Use black/blue ink only.",
426
+ "Section B is compulsory to attempt any two portions.",
427
+ "Write neat and clean.",
428
+ "Mobile phones are strictly prohibited."
429
+ ]
430
+ };
431
+ }
432
+
433
+ getUrduStructure(grade) {
434
+ return {
435
+ header: {
436
+ board: "بورڈ آف انٹرمیڈیٹ اینڈ سیکنڈری ایجوکیشن گوجرانوالہ",
437
+ class: grade,
438
+ subject: "اردو",
439
+ marks: 75,
440
+ time: "2:30 گھنٹے"
441
+ },
442
+ sections: [
443
+ {
444
+ title: "حصہ اول – معروضی سوالات",
445
+ marks: 12,
446
+ content: [
447
+ "12 معروضی سوالات",
448
+ "• گرامر سے متعلق",
449
+ "• تشریح سے متعلق",
450
+ "• الفاظ معانی/متضادات"
451
+ ]
452
+ },
453
+ {
454
+ title: "حصہ دوم – مختصر سوالات",
455
+ portions: [
456
+ { name: "حصہ نمبر ۱", desc: "نصابی کتاب سے 9 سوالات (کوئی 6 حل کریں)", marks: "2 نمبر" },
457
+ { name: "حصہ نمبر ۲", desc: "گرامر سے 9 سوالات (کوئی 6 حل کریں)", marks: "2 نمبر" },
458
+ { name: "حصہ نمبر ۳", desc: "تشریح/ترجمہ سے 9 سوالات (کوئی 6 حل کریں)", marks: "2 نمبر" }
459
+ ],
460
+ note: "کسی بھی دو حصے مکمل حل کریں"
461
+ },
462
+ {
463
+ title: "حصہ سوم – طویل سوالات",
464
+ questions: [
465
+ "۱. مضمون نویسی (۳ میں سے ۱) – [۱۰ نمبر]",
466
+ "۲. خط/درخواست نویسی – [۸ نمبر]",
467
+ "۳. تشریح (آنے والے اقتباسات میں سے) – [۱۰ نمبر]",
468
+ "۴. ترجمہ – [۸ نمبر]"
469
+ ]
470
+ }
471
+ ],
472
+ instructions: [
473
+ "نیلے یا سیاہ ink کا استعمال کریں۔",
474
+ "دو حصوں کا حل کرنا لازمی ہے۔",
475
+ "صاف ستھرا لکھیں۔",
476
+ "موبائل فون ممنوع ہے۔"
477
+ ]
478
+ };
479
+ }
480
+
481
+ getGeneralStructure(grade, subject) {
482
+ // Shuffle chapters based on version for variety
483
+ const versionOffset = currentVersion.charCodeAt(0) - 65; // 0 for A, 1 for B, 2 for C
484
+ const chapters1 = `Chapters ${1 + versionOffset}-${6 + versionOffset}`;
485
+ const chapters2 = `Chapters ${7 + versionOffset}-${12 + versionOffset}`;
486
+
487
+ return {
488
+ header: {
489
+ board: "Board of Intermediate & Secondary Education Gujranwala",
490
+ class: grade,
491
+ subject: subject,
492
+ marks: 75,
493
+ time: "2:30 Hours"
494
+ },
495
+ sections: [
496
+ {
497
+ title: "SECTION A – Objective Type",
498
+ marks: 12,
499
+ content: [
500
+ "12 Multiple Choice Questions (MCQs)",
501
+ "Each question carries 1 mark",
502
+ "Covering full syllabus content",
503
+ "No negative marking",
504
+ `Version Set: ${currentVersion} (Questions may vary from other sets)`
505
+ ]
506
+ },
507
+ {
508
+ title: "SECTION B – Short Questions",
509
+ portions: [
510
+ { name: "Portion I", desc: `9 Short Questions from ${chapters1} (Attempt any 6)`, marks: "2 marks each" },
511
+ { name: "Portion II", desc: `9 Short Questions from ${chapters2} (Attempt any 6)`, marks: "2 marks each" },
512
+ { name: "Portion III", desc: "9 Short Questions from Practical/Theory Mix (Attempt any 6)", marks: "2 marks each" }
513
+ ],
514
+ note: `Attempt any TWO portions completely. Total marks: 24 | Set ${currentVersion}`
515
+ },
516
+ {
517
+ title: "SECTION C – Detailed Questions",
518
+ questions: [
519
+ `1. Long Question from Core Theory (Set ${currentVersion}) - [8 Marks]`,
520
+ `2. Numerical Problem (if applicable) - [8 Marks]`,
521
+ `3. Diagram/Explanation Question - [8 Marks]`,
522
+ `4. Practical/Application Based - [8 Marks]`
523
+ ],
524
+ note: "Attempt any TWO questions. Each carries 8 marks."
525
+ }
526
+ ],
527
+ instructions: [
528
+ "Attempt all questions according to instructions.",
529
+ "Write your Roll Number clearly on the top of this page.",
530
+ "Use of scientific calculator allowed (except programming subjects).",
531
+ "For numericals, show complete working.",
532
+ "Follow Punjab Board marking scheme.",
533
+ `This is Set ${currentVersion}. Do not mix with other sets.`
534
+ ],
535
+ subjectSpecific: this.getSubjectNotes(subject)
536
+ };
537
+ }
538
+
539
+ getSubjectNotes(subject) {
540
+ const notes = {
541
+ "Mathematics": "• Theorems must be proved with proper statements\n• Diagrams should be neat and labeled",
542
+ "Physics": "• Units must be written in numericals\n• Derivation steps carry marks",
543
+ "Chemistry": "• Chemical equations must be balanced\n• Structures should be clear",
544
+ "Biology": "• Label diagrams properly\n• Technical terms must be accurate",
545
+ "Computer Science": "• Write programs with comments\n• Flow charts carry separate marks"
546
+ };
547
+ return notes[subject] || "";
548
+ }
549
+
550
+ customizeQuestion(original, updated) {
551
+ return {
552
+ success: true,
553
+ original,
554
+ updated,
555
+ timestamp: new Date().toISOString()
556
+ };
557
+ }
558
+ }
559
+
560
+ // Version Selection
561
+ function selectVersion(version) {
562
+ currentVersion = version;
563
+ document.querySelectorAll('.version-btn').forEach(btn => {
564
+ btn.classList.remove('border-indigo-500', 'bg-indigo-50', 'text-indigo-700');
565
+ btn.classList.add('border-gray-200', 'text-gray-600');
566
+ });
567
+ document.getElementById(`version-${version}`).classList.add('border-indigo-500', 'bg-indigo-50', 'text-indigo-700');
568
+ document.getElementById(`version-${version}`).classList.remove('border-gray-200', 'text-gray-600');
569
+ }
570
+
571
+ // Toggle Answer Key
572
+ function toggleAnswerKey() {
573
+ answerKeyMode = document.getElementById('include-answer-key').checked;
574
+ const answerSection = document.getElementById('answer-key-section');
575
+ if (answerSection) {
576
+ if (answerKeyMode && !answerSection.classList.contains('hidden')) {
577
+ // Already visible
578
+ } else if (!answerKeyMode) {
579
+ answerSection.classList.add('hidden');
580
+ }
581
+ }
582
+ }
583
+
584
+ // Timer Functions
585
+ function startTimer() {
586
+ if (timerInterval) clearInterval(timerInterval);
587
+ let hours = 2, minutes = 30, seconds = 0;
588
+ const display = document.getElementById('timer-count');
589
+ const timerDisplay = document.getElementById('timer-display');
590
+
591
+ timerDisplay.classList.remove('hidden');
592
+
593
+ timerInterval = setInterval(() => {
594
+ if (seconds === 0) {
595
+ if (minutes === 0) {
596
+ if (hours === 0) {
597
+ clearInterval(timerInterval);
598
+ alert("Time's up! Exam finished.");
599
+ return;
600
+ }
601
+ hours--;
602
+ minutes = 59;
603
+ } else {
604
+ minutes--;
605
+ }
606
+ seconds = 59;
607
+ } else {
608
+ seconds--;
609
+ }
610
+
611
+ display.textContent = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
612
+
613
+ // Warning colors
614
+ if (hours === 0 && minutes < 15) {
615
+ display.classList.add('text-red-500');
616
+ display.parentElement.classList.add('border-red-500');
617
+ }
618
+ }, 1000);
619
+ }
620
+
621
+ function stopTimer() {
622
+ if (timerInterval) {
623
+ clearInterval(timerInterval);
624
+ timerInterval = null;
625
+ }
626
+ document.getElementById('timer-display').classList.add('hidden');
627
+ }
628
+
629
+ // Save Paper to LocalStorage
630
+ function savePaper() {
631
+ if (!currentGrade || !currentSubject) {
632
+ alert('Please generate a paper first!');
633
+ return;
634
+ }
635
+
636
+ const paperData = {
637
+ grade: currentGrade,
638
+ subject: currentSubject,
639
+ version: currentVersion,
640
+ date: new Date().toISOString(),
641
+ content: document.getElementById('paper-content').innerHTML,
642
+ studentInfo: {
643
+ name: document.getElementById('student-name').value,
644
+ rollNo: document.getElementById('roll-number').value,
645
+ examDate: document.getElementById('exam-date').value
646
+ }
647
+ };
648
+
649
+ let saved = JSON.parse(localStorage.getItem('punjabBoardPapers') || '[]');
650
+ saved.unshift(paperData);
651
+ if (saved.length > 10) saved = saved.slice(0, 10); // Keep only last 10
652
+ localStorage.setItem('punjabBoardPapers', JSON.stringify(saved));
653
+
654
+ loadSavedPapers();
655
+ alert('Paper saved successfully!');
656
+ }
657
+
658
+ function loadSavedPapers() {
659
+ const saved = JSON.parse(localStorage.getItem('punjabBoardPapers') || '[]');
660
+ const container = document.getElementById('saved-papers-section');
661
+ const list = document.getElementById('saved-papers-list');
662
+
663
+ if (saved.length === 0) {
664
+ container.classList.add('hidden');
665
+ return;
666
+ }
667
+
668
+ container.classList.remove('hidden');
669
+ list.innerHTML = saved.map((paper, index) => `
670
+ <div class="bg-white border-2 border-gray-200 rounded-lg p-3 flex justify-between items-center hover:border-indigo-300 transition-colors">
671
+ <div class="overflow-hidden">
672
+ <div class="font-semibold text-sm truncate">${paper.subject} - ${paper.grade}</div>
673
+ <div class="text-xs text-gray-500">Set ${paper.version} • ${new Date(paper.date).toLocaleDateString()}</div>
674
+ </div>
675
+ <button onclick="loadPaper(${index})" class="ml-2 px-3 py-1 bg-indigo-100 text-indigo-700 rounded-lg text-xs font-semibold hover:bg-indigo-200">
676
+ Load
677
+ </button>
678
+ </div>
679
+ `).join('');
680
+ }
681
+
682
+ function loadPaper(index) {
683
+ const saved = JSON.parse(localStorage.getItem('punjabBoardPapers') || '[]');
684
+ if (saved[index]) {
685
+ const paper = saved[index];
686
+ selectGrade(paper.grade);
687
+ selectSubject(paper.subject);
688
+ selectVersion(paper.version);
689
+
690
+ document.getElementById('student-name').value = paper.studentInfo?.name || '';
691
+ document.getElementById('roll-number').value = paper.studentInfo?.rollNo || '';
692
+ document.getElementById('exam-date').value = paper.studentInfo?.examDate || '';
693
+
694
+ document.getElementById('paper-content').innerHTML = paper.content;
695
+ document.getElementById('paper-container').classList.remove('hidden');
696
+ document.getElementById('empty-state').classList.add('hidden');
697
+
698
+ // Update display
699
+ document.getElementById('paper-grade').textContent = paper.grade;
700
+ document.getElementById('paper-subject').textContent = paper.subject;
701
+ document.getElementById('paper-version-display').textContent = paper.version;
702
+
703
+ lucide.createIcons();
704
+ }
705
+ }
706
+
707
+ function clearAllSaved() {
708
+ if (confirm('Clear all saved papers?')) {
709
+ localStorage.removeItem('punjabBoardPapers');
710
+ document.getElementById('saved-papers-section').classList.add('hidden');
711
+ }
712
+ }
713
+
714
+ // PDF Download using html2canvas + jsPDF
715
+ async function downloadPDF() {
716
+ const paperContainer = document.getElementById('main-paper');
717
+ if (!paperContainer || paperContainer.classList.contains('hidden')) {
718
+ alert('Please generate a paper first!');
719
+ return;
720
+ }
721
+
722
+ const { jsPDF } = window.jspdf;
723
+ const pdf = new jsPDF('p', 'mm', 'a4');
724
+
725
+ try {
726
+ const canvas = await html2canvas(paperContainer, {
727
+ scale: 2,
728
+ useCORS: true,
729
+ allowTaint: true,
730
+ backgroundColor: '#ffffff'
731
+ });
732
+
733
+ const imgData = canvas.toDataURL('image/png');
734
+ const imgWidth = 210; // A4 width in mm
735
+ const pageHeight = 297; // A4 height in mm
736
+ const imgHeight = (canvas.height * imgWidth) / canvas.width;
737
+
738
+ let heightLeft = imgHeight;
739
+ let position = 0;
740
+
741
+ pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);
742
+ heightLeft -= pageHeight;
743
+
744
+ // Add new pages if content overflows
745
+ while (heightLeft > 0) {
746
+ position = heightLeft - imgHeight;
747
+ pdf.addPage();
748
+ pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);
749
+ heightLeft -= pageHeight;
750
+ }
751
+
752
+ // Add answer key if enabled
753
+ if (answerKeyMode && !document.getElementById('answer-key-section').classList.contains('hidden')) {
754
+ pdf.addPage();
755
+ const answerCanvas = await html2canvas(document.getElementById('answer-key-section'), {
756
+ scale: 2,
757
+ backgroundColor: '#fef3c7'
758
+ });
759
+ const answerImg = answerCanvas.toDataURL('image/png');
760
+ const ansHeight = (answerCanvas.height * imgWidth) / answerCanvas.width;
761
+ pdf.addImage(answerImg, 'PNG', 0, 0, imgWidth, ansHeight);
762
+ }
763
+
764
+ const fileName = `Punjab_Board_${currentSubject}_Class${currentGrade}_Set${currentVersion}.pdf`;
765
+ pdf.save(fileName);
766
+
767
+ } catch (error) {
768
+ console.error('PDF generation failed:', error);
769
+ alert('Failed to generate PDF. Please try printing instead.');
770
+ }
771
+ }
772
+
773
+ // UI Functions
774
+ function selectGrade(grade) {
775
+ currentGrade = grade;
776
+ document.querySelectorAll('.grade-btn').forEach(btn => {
777
+ btn.classList.remove('border-indigo-500', 'text-indigo-600', 'bg-indigo-50');
778
+ btn.classList.add('border-gray-200');
779
+ });
780
+ <script src="https://deepsite.hf.co/deepsite-badge.js"></script>