-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg.u.html
More file actions
375 lines (333 loc) · 10.9 KB
/
g.u.html
File metadata and controls
375 lines (333 loc) · 10.9 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>QuranBits - Quran Explorer</title>
<link href="https://fonts.googleapis.com/css2?family=Amiri+Quran&family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
<style>
/* 🎨 NEW DARK THEME PALETTE */
:root {
--color-primary-dark: #1a2a3a; /* Deep Night Blue */
--color-card-dark: #243447; /* Slightly lighter card background */
--color-gold: #b79b5c; /* Antique Gold accent */
--color-text-light: #f1f6fc; /* Creamy white for body text */
--color-text-muted: #9aaabb; /* Grayish blue for muted text */
--color-text-arabic: #e3c480; /* Lighter Gold for primary Arabic */
--color-border: #334455; /* Subtle border color */
--radius: 8px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Inter', sans-serif;
background: var(--color-primary-dark);
color: var(--color-text-light);
line-height: 1.6;
}
/* HEADER */
header {
background: #101925; /* Even darker header */
color: white;
padding: 30px 20px;
text-align: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
border-bottom: 3px solid var(--color-gold);
}
header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
letter-spacing: 2px;
color: var(--color-gold);
}
header p {
opacity: 0.8;
font-size: 1.1rem;
}
.container {
max-width: 1200px;
margin: 40px auto;
padding: 0 20px;
}
h2 {
color: var(--color-gold);
margin-bottom: 20px;
border-left: 4px solid var(--color-gold);
padding-left: 15px;
font-weight: 700;
}
.loading {
text-align: center;
padding: 60px;
color: var(--color-text-muted);
font-size: 1.2rem;
}
/* SURAH LIST TABLE */
.surah-list {
background: var(--color-card-dark);
border-radius: var(--radius);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
overflow: hidden;
margin-bottom: 40px;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 16px 20px;
text-align: left;
border-bottom: 1px solid var(--color-border);
}
th {
background: #2a415a; /* Darker blue header row */
color: var(--color-gold);
font-weight: 600;
text-transform: uppercase;
}
tr:hover {
background-color: #334a64; /* Visible hover effect */
transition: 0.2s ease;
}
.surah-link {
color: var(--color-text-light);
font-weight: 600;
text-decoration: none;
}
.surah-link:hover {
color: var(--color-gold);
}
.arabic-text-col { /* Specific styling for Arabic in the table */
font-family: 'Amiri Quran', serif;
font-size: 1.1rem;
direction: rtl;
}
/* AYAH DETAIL VIEW */
.ayah-container {
background: var(--color-card-dark);
padding: 25px;
margin-bottom: 20px;
border-radius: var(--radius);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.ayah-number {
background: var(--color-gold);
color: var(--color-primary-dark);
display: inline-block;
min-width: 32px;
height: 32px;
text-align: center;
line-height: 32px;
border-radius: 50%;
margin-right: 15px;
font-size: 1rem;
font-weight: 700;
}
.arabic-text {
font-family: 'Amiri Quran', serif;
font-size: 1.8rem; /* Larger for focus */
direction: rtl;
color: var(--color-text-arabic);
line-height: 2.2;
margin-top: 15px;
}
.simplified-arabic {
font-family: 'Amiri Quran', serif;
font-size: 1.2rem;
direction: rtl;
color: var(--color-text-muted);
margin-top: 8px;
}
.translation {
font-style: italic;
color: var(--color-text-light);
margin-top: 12px;
padding-top: 10px;
border-top: 1px dashed var(--color-border);
}
/* AUDIO CONTROLS */
.audio-controls {
background: #142131; /* Even darker for controls */
padding: 15px;
border-radius: var(--radius);
margin: 20px 0;
border: 1px solid var(--color-border);
}
select {
margin-top: 8px;
width: 100%;
font-size: 1rem;
padding: 10px;
background: var(--color-card-dark);
color: var(--color-text-light);
border: 1px solid var(--color-gold);
border-radius: 6px;
appearance: none; /* remove default arrow */
}
audio {
margin-top: 15px;
width: 100%;
/* Default browser audio controls are tricky to style, but they inherit some colors */
}
/* BACK BUTTON */
.back-button {
background: var(--color-gold);
color: var(--color-primary-dark);
padding: 10px 20px;
border-radius: 6px;
text-decoration: none;
font-weight: 700;
display: inline-block;
margin-bottom: 20px;
transition: 0.3s ease;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}
.back-button:hover {
background: #ccb073;
}
/* FOOTER */
footer {
background: #101925;
padding: 30px 20px;
text-align: center;
color: var(--color-text-muted);
border-top: 2px solid var(--color-border);
margin-top: 60px;
line-height: 1.8;
}
footer a {
color: var(--color-gold);
text-decoration: none;
font-weight: 600;
}
footer a:hover {
color: #e3c480;
text-decoration: underline;
}
@media (max-width: 768px) {
header h1 { font-size: 2rem; }
th, td { padding: 12px 10px; font-size: 0.85rem; }
.arabic-text { font-size: 1.5rem; }
.ayah-container { padding: 20px; }
.ayah-number { width: 28px; height: 28px; line-height: 28px; font-size: 0.9rem; }
}
</style>
</head>
<Script src="q.u.js"></Script>
<body>
<header>
<h1>QuranBits</h1>
<p>Explore the Holy Quran with translations, audio, and meaning — by <strong>Mr. Abdu Salim</strong></p>
</header>
<div class="container">
<div id="app">
<div id="loading" class="loading">Loading Quran data...</div>
</div>
</div>
<footer>
<p><strong>Contact Developer:</strong></p>
<p>Email: <a href="mailto:salimabdu759@gmail.com">salimabdu759@gmail.com</a></p>
<p>Mobile: <a href="tel:+250739390715">+250 739 390 715</a></p>
<p>📍 Kigali, Rwanda</p>
<p>QuranBits © 2025 | Data from <a href="https://quranapi.pages.dev" target="_blank">Quran API</a></p>
</footer>
<script>
// **NOTE: The JavaScript code remains unchanged as it is excellent.**
const SURAH_LIST_API_URL = 'https://quranapi.pages.dev/api/surah.json';
const app = document.getElementById('app');
const loading = document.getElementById('loading');
let surahs = [];
let currentSurah = null;
document.addEventListener('DOMContentLoaded', loadSurahList);
async function loadSurahList() {
try {
loading.style.display = 'block';
const response = await fetch(SURAH_LIST_API_URL);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
surahs = await response.json();
renderSurahList();
} catch (error) {
app.innerHTML = `<div class="error" style="color:red;">Failed to load Surah list. Please try again later.</div>`;
} finally {
loading.style.display = 'none';
}
}
function renderSurahList() {
app.innerHTML = `
<h2>List of Surahs</h2>
<div class="surah-list">
<table>
<thead>
<tr><th>#</th><th>Name</th><th><span class="arabic-text-col">Arabic</span></th><th>Translation</th><th>Revelation</th><th>Ayahs</th></tr>
</thead>
<tbody>
${surahs.map(s => `
<tr>
<td>${s.surahNo}</td>
<td><a href="#" class="surah-link" data-no="${s.surahNo}">${s.surahName}</a></td>
<td class="arabic-text-col">${s.surahNameArabic}</td>
<td>${s.surahNameTranslation}</td>
<td>${s.revelationPlace}</td>
<td>${s.totalAyah}</td>
</tr>`).join('')}
</tbody>
</table>
</div>
`;
document.querySelectorAll('.surah-link').forEach(link =>
link.addEventListener('click', e => {
e.preventDefault();
loadSurahDetails(link.dataset.no);
})
);
}
async function loadSurahDetails(no) {
try {
loading.style.display = 'block';
const response = await fetch(`https://quranapi.pages.dev/api/${no}.json`);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
currentSurah = await response.json();
renderSurahDetails();
} catch (e) {
app.innerHTML = `<div class="error" style="color:red;">Could not load Surah details.</div>`;
} finally {
loading.style.display = 'none';
}
}
function renderSurahDetails() {
if (!currentSurah) return;
const reciters = { 1: 'Mishary Al Afasy', 2: 'Abu Bakr Al Shatri', 3: 'Nasser Al Qatami' };
app.innerHTML = `
<a href="#" class="back-button" id="back">← Back to List</a>
<h2>${currentSurah.surahName} (${currentSurah.surahNameArabic})</h2>
<p style="color: var(--color-text-muted); margin-bottom: 20px;">
<strong>Translation:</strong> ${currentSurah.surahNameTranslation} |
<strong>Revelation:</strong> ${currentSurah.revelationPlace} |
<strong>Ayahs:</strong> ${currentSurah.totalAyah}
</p>
<div class="audio-controls">
<label for="reciter">Select Reciter:</label>
<select id="reciter">
${Object.entries(reciters).map(([id, name]) => `<option value="${id}">${name}</option>`).join('')}
</select>
<audio id="surah-audio" controls>
<source src="${currentSurah.audio['1'].url}" type="audio/mp3">
</audio>
</div>
${currentSurah.arabic1.map((ayah, i) => `
<div class="ayah-container">
<span class="ayah-number">${i + 1}</span>
<div class="arabic-text">${ayah}</div>
<div class="simplified-arabic">${currentSurah.arabic2[i]}</div>
<div class="translation">${currentSurah.english[i]}</div>
<audio controls src="https://quranaudio.pages.dev/1/${currentSurah.surahNo}_${i + 1}.mp3" style="margin-top:15px;"></audio>
</div>`).join('')}
`;
document.getElementById('back').addEventListener('click', e => { e.preventDefault(); renderSurahList(); });
document.getElementById('reciter').addEventListener('change', e => {
document.getElementById('surah-audio').src = currentSurah.audio[e.target.value].url;
});
}
// Initial call remains at the bottom
</script>
</body>
</html>