-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbooks.html
475 lines (418 loc) · 15.8 KB
/
books.html
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="manifest" href="manifest.json">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<title>Books List</title>
<style>
/* General Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background-color: #f9f9f9;
color: #333; /* Default text color for light mode */
line-height: 1.6;
padding: 0;
margin: 0;
}
/* Dark Mode */
body.dark-mode {
background-color: #1a1a1a; /* Dark background */
color: #ddd; /* Lighter text for dark mode */
}
h1,
h2 {
text-align: center;
font-size: 2rem;
margin-top: 50px;
padding: 0 10px;
}
h1 {
color: #2c3e50;
}
body.dark-mode h1 {
color: #3498db; /* Lighter color for heading in dark mode */
}
/* Header styles */
header {
color: white;
padding: 10px;
text-align: center;
font-size: 2rem;
background-color: #3498db;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
/* Settings Section */
.settings-container {
display: flex;
justify-content: flex-start;
align-items: center;
padding: 10px 20px;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
background-color: #BEBEBE;
}
.settings-item {
margin-right: 20px;
cursor: pointer;
font-size: 1.5rem;
position: relative;
}
/* Dark Mode Settings Section */
.settings-container.dark-mode {
background-color: #1a1a1a;
}
.settings-item img {
width: 24px; /* Set the icon size */
height: 24px; /* Set the icon size */
object-fit: contain;
}
.settings-item.dark-mode img {
filter: brightness(1.2); /* Brighter icons in dark mode */
}
.book-details {
text-align: center;
margin-top: 20px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
margin-bottom: 30px;
box-shadow: none;
}
.book-details h2 {
color: #3498db;
font-size: 1.5rem;
}
body.dark-mode .book-details {
background-color: #333;
color: #ddd; /* Light text color for dark mode */
}
.book-details p {
font-size: 1rem;
color: #555;
}
body.dark-mode .book-details p {
color: #ddd; /* Lighter text color for dark mode */
}
/* List for Books */
.book-list {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0;
list-style-type: none;
}
.book-item {
display: block;
background-color: #fff;
padding: 20px;
margin-bottom: 15px;
border-left: 4px solid #3498db;
border-radius: 8px;
transition: background-color 0.3s ease, transform 0.3s ease;
cursor: pointer;
text-decoration: none;
}
.book-item:hover {
background-color: #f1f1f1;
transform: scale(1.02);
}
.book-item h3 {
font-size: 1.3rem;
color: #333;
margin-bottom: 5px;
padding-left: 30px; /* To add space for the image */
background-image: url('https://quran-online.pages.dev/source/download.png');
background-repeat: no-repeat;
background-size: 20px 20px; /* Adjust the size of the image */
background-position: left center;
}
.book-item p {
font-size: 1rem;
color: #777;
margin: 5px 0;
}
/* Dark Mode for Book Items */
body.dark-mode .book-item {
background-color: #333;
border: 1px solid #444;
}
body.dark-mode .book-item h3 {
color: #ddd;
}
body.dark-mode .book-item p {
color: #bbb;
}
/* Tooltip styles */
.tooltip {
position: absolute;
top: -30px;
left: 50%;
transform: translateX(-50%);
padding: 5px 10px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border-radius: 5px;
font-size: 12px;
visibility: hidden;
}
/* PWA Install Button */
.install-pwa {
font-size: 1.5rem;
cursor: pointer;
color: #3498db;
}
/* Tooltip visibility on hover */
.settings-item:hover .tooltip {
visibility: visible;
}
/* Responsive Design */
@media (max-width: 768px) {
.book-list {
padding: 10px;
}
h1 {
font-size: 1.8rem;
padding: 0 20px;
}
.book-details h2 {
font-size: 1.3rem;
}
.book-details p {
font-size: 0.9rem;
}
.book-item {
padding: 15px;
}
.book-item h3 {
font-size: 1.1rem;
}
.book-item p {
font-size: 0.9rem;
}
}
@media (max-width: 480px) {
.book-item h3 {
font-size: 1rem;
}
.book-item p {
font-size: 0.9rem;
}
.book-item a {
font-size: 1rem;
}
}
</style>
</head>
<body>
<!-- Settings Section at the top (Fixed) -->
<div class="settings-container">
<!-- Dark/Light Mode Toggle -->
<div class="settings-item" onclick="toggleTheme()">
<i class="fas fa-moon"></i>
<div class="tooltip">Dark Mode</div>
</div>
<!-- Hadith Link -->
<div class="settings-item">
<a href="index.html">
<i class="fas fa-home"></i> <!-- Home -->
</a>
<div class="tooltip">Home</div>
</div>
<!-- Kalima Link -->
<div class="settings-item">
<a href="kalima.html">
<i class="fas fa-hand-point-right"></i> <!-- Kalima -->
</a>
<div class="tooltip">Kalima</div>
</div>
<!-- Tasbih Link -->
<div class="settings-item">
<a href="tasbih.html">
<i class="fas fa-praying-hands"></i> <!-- Tasbih -->
</a>
<div class="tooltip">Tasbih</div>
</div>
<!-- 99 Names Link -->
<div class="settings-item">
<a href="99-names.html">
<i class="fas fa-mosque"></i> <!-- 99 Names -->
</a>
<div class="tooltip">99 Names</div>
</div>
<!-- Prayer Link -->
<div class="settings-item">
<a href="prayer.html">
<i class="fas fa-pray"></i> <!-- Prayer -->
</a>
<div class="tooltip">Prayer</div>
</div>
<!-- PWA Install Button -->
<div class="settings-item install-pwa" onclick="installPWA()">
<i class="fas fa-download"></i> <!-- Install PWA -->
<div class="tooltip">Install PWA</div>
</div>
</div>
<h1>Books List</h1>
<div class="book-details">
<h2 id="bookTitle"></h2>
<p><strong>Author:</strong> <span id="bookAuthor"></span></p>
<p id="bookDescription"></p> <!-- Added for description -->
</div>
<ul class="book-list" id="bookList"></ul>
<script>
const books = [
{
id: 1,
arabic: { title: "صحيح البخاري", author: "الإمام محمد بن إسماعيل البخاري" },
english: { title: "Sahih al-Bukhari", author: "Imam Muhammad ibn Ismail al-Bukhari" },
description: "Sahih al-Bukhari is one of the six major hadith collections in Sunni Islam. It is considered the most authentic collection of hadith.",
route: { base: "bukhari" }
},
{
id: 2,
arabic: { title: "صحيح مسلم", author: "الإمام مسلم بن الحجاج القشيري النيسابوري" },
english: { title: "Sahih Muslim", author: "Imam Muslim ibn al-Hajjaj al-Naysaburi" },
description: "Sahih Muslim is another important hadith collection, known for its rigorous criteria for accepting hadiths.",
route: { base: "muslim" }
},
{
id: 3,
arabic: { title: "سنن أبي داود", author: "الإمام سليمان بن الأشعث أبو داود السجستاني" },
english: { title: "Sunan Abi Dawud", author: "Imam Sulayman ibn al-Ash'ath Abu Dawud al-Sijistani" },
description: "Sunan Abi Dawud is a collection of hadith compiled by Abu Dawood, focusing on jurisprudence and ethics.",
route: { base: "abudawud" }
},
{
id: 4,
arabic: { title: "سنن الترمذي", author: "الإمام أبو عيسى الترمذي" },
english: { title: "Sunan al-Tirmidhi", author: "Imam Abu 'Isa al-Tirmidhi" },
description: "Sunan al-Tirmidhi is a compilation of hadiths that contain detailed commentary on their authenticity and contextual use.",
route: { base: "tirmidhi" }
},
{
id: 5,
arabic: { title: "سنن النسائي", author: "الإمام أحمد بن شعيب النسائي" },
english: { title: "Sunan al-Nasa'i", author: "Imam Ahmad ibn Shu'ayb al-Nasa'i" },
description: "Sunan al-Nasa'i is another major hadith collection that is famous for its selection of authentic hadiths.",
route: { base: "nasai" }
},
{
id: 6,
arabic: { title: "سنن ابن ماجه", author: "الإمام محمد بن يزيد بن ماجه القزويني" },
english: { title: "Sunan Ibn Majah", author: "Imam Muhammad ibn Yazid Ibn Majah al-Qazwini" },
description: "Sunan Ibn Majah is a significant hadith collection with a broad range of topics from Islamic law to ethics.",
route: { base: "ibnmajah" }
},
{
id: 7,
arabic: { title: "موطأ مالك", author: "الإمام مالك بن أنس" },
english: { title: "Muwatta Malik", author: "Imam Malik ibn Anas" },
description: "Muwatta Malik is one of the earliest works of Islamic jurisprudence, compiled by Imam Malik.",
route: { base: "malik" }
},
{
id: 8,
arabic: { title: "مسند الإمام أحمد بن حنبل", author: "الإمام أحمد بن حنبل" },
english: { title: "Musnad Ahmad ibn Hanbal", author: "Imam Ahmad ibn Hanbal" },
description: "Musnad Ahmad is a collection of hadith compiled by Imam Ahmad ibn Hanbal, covering a wide range of topics.",
route: { base: "ahmed" }
},
{
id: 9,
arabic: { title: "سنن الدارمي", author: "الإمام أبو محمد عبد الرحمن بن عبد الله بن الدارمي" },
english: { title: "Sunan al-Darimi", author: "Imam Abu Muhammad Abd al-Rahman ibn Abd Allah ibn al-Darimi" },
description: "Sunan al-Darimi is a collection of hadiths known for its authenticity and detailed narratives.",
route: { base: "darimi" }
}
];
const urlParams = new URLSearchParams(window.location.search);
const bookSlug = urlParams.get('book');
const book = books.find(b => b.route.base === bookSlug);
if (book) {
document.getElementById("bookTitle").textContent = book.english.title;
document.getElementById("bookAuthor").textContent = book.english.author;
document.getElementById("bookDescription").textContent = book.description; // Display book description
const booksUrl = `https://raw.githubusercontent.com/itzfew/Quran-Online/refs/heads/main/source/hadiths/${bookSlug}/books.json`;
fetch(booksUrl)
.then(response => response.json())
.then(data => {
const bookList = document.getElementById("bookList");
data.collection.books.forEach(bookItem => {
const bookElement = document.createElement('a');
bookElement.href = `book.html?book=${bookSlug}&bookNumber=${bookItem.book_number}`;
bookElement.classList.add('book-item');
bookElement.innerHTML = `
<h3>Book ${bookItem.book_number}</h3>
<p>${bookItem.book_name}</p>
<p><strong>Hadith Range:</strong> ${bookItem.hadith_range}</p>
`;
bookList.appendChild(bookElement);
});
})
.catch(error => {
console.error('Error fetching book data:', error);
document.getElementById("bookList").innerHTML = "<p>Could not load books at this time.</p>";
});
} else {
document.getElementById("bookList").innerHTML = "<p>No books found for this collection.</p>";
}
// Toggle Dark/Light Mode
function toggleTheme() {
const isDark = document.body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
}
// Set theme based on user preference
window.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('darkMode');
if (savedTheme === 'true') {
document.body.classList.add('dark-mode');
}
});
// Function to handle PWA installation
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
});
function installPWA() {
if (deferredPrompt) {
deferredPrompt.prompt();
deferredPrompt.userChoice.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the A2HS prompt');
} else {
console.log('User dismissed the A2HS prompt');
}
});
deferredPrompt = null;
}
}
// Register Service Worker for PWA functionality
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js')
.then((registration) => {
console.log('Service Worker registered with scope:', registration.scope);
})
.catch((error) => {
console.log('Service Worker registration failed:', error);
});
});
}
</script>
</body>
</html>