-
Notifications
You must be signed in to change notification settings - Fork 2
/
hadith.html
311 lines (279 loc) · 11 KB
/
hadith.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hadith Books List</title>
<!-- Link to PWA Manifest -->
<link rel="manifest" href="manifest.json">
<!-- Include Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
line-height: 1.6;
}
/* Dark Mode */
body.dark-mode {
background-color: #1a1a1a; /* Dark background */
color: #fff; /* White text */
}
h1 {
text-align: center;
color: #2c3e50;
font-size: 2rem;
margin-top: 60px;
padding: 0 10px;
}
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-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: #f0f0f0;
}
.settings-item {
margin-right: 20px;
font-size: 24px;
cursor: pointer;
color: black; /* Default color for settings items */
}
.settings-container.dark-mode {
background-color: #333;
}
.settings-item.dark-mode {
color: white;
}
.book-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 80px;
padding: 0px;
}
.book-item {
background-color: #fff;
border-radius: 3px;
box-shadow: 0 0px 0px rgba(0, 0, 0, 0.1);
margin: 5px;
padding: 0px;
text-align: center;
width: 100%;
transition: transform 0.2s ease;
position: relative;
}
.book-item:hover {
transform: translateY(-5px);
}
.book-item a {
text-decoration: none;
color: #3498db;
font-weight: bold;
font-size: 18px;
}
.book-item a:hover {
color: #2980b9;
}
.book-item h3 {
margin: 0;
color: #16a085;
font-size: 20px;
}
.book-item p {
color: #7f8c8d;
}
/* Numbering background image */
.book-item .numbering {
position: absolute;
top: 10px;
left: 10px;
width: 40px;
height: 40px;
background-image: url('https://quran-online.pages.dev/source/download.png');
background-size: cover;
background-position: center;
border-radius: 50%;
color: black; /* Light color for the number */
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 16px;
border: 2px solid #fff; /* White border for better contrast */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Shadow for better visibility */
}
/* Dark Mode Surah Card */
body.dark-mode .book-item {
background-color: #1a1a1a; /* Dark background for Surah item */
border: 1px solid #444; /* Slightly darker border */
}
body.dark-mode .numbering {
color: white; /* Dark background for Surah item */
}
</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-adjust"></i> <!-- Dark/Light Mode toggle -->
</div>
<!-- Install App -->
<div class="settings-item" onclick="installPWA()">
<i class="fas fa-download"></i> <!-- Install App -->
</div>
<!-- Hadith Link -->
<div class="settings-item">
<a href="hadith.html">
<i class="fas fa-book-open"></i> <!-- Hadith -->
</a>
</div>
<!-- Tasbih Link -->
<div class="settings-item">
<a href="tasbih.html">
<i class="fas fa-pray"></i> <!-- Tasbih -->
</a>
</div>
</div>
<h1>Hadith Books</h1>
<div class="book-list" id="bookList"></div>
<script>
const books = [
{
id: 1,
arabic: { title: "صحيح البخاري", author: "الإمام محمد بن إسماعيل البخاري" },
english: { title: "Sahih al-Bukhari", author: "Imam Muhammad ibn Ismail al-Bukhari" },
route: { base: "bukhari", chapters: Array.from({ length: 97 }, (_, i) => (i + 1).toString()) }
},
{
id: 2,
arabic: { title: "صحيح مسلم", author: "الإمام مسلم بن الحجاج القشيري النيسابوري" },
english: { title: "Sahih Muslim", author: "Imam Muslim ibn al-Hajjaj al-Naysaburi" },
route: { base: "muslim", chapters: ["introduction", ...Array.from({ length: 56 }, (_, i) => (i + 1).toString())] }
},
{
id: 3,
arabic: { title: "سنن النسائي", author: "الإمام أبو عبد الرحمن أحمد بن شعيب النسائي" },
english: { title: "Sunan al-Nasa'i", author: "Imam Ahmad ibn Shu'ayb al-Nasa'i" },
route: { base: "nasai", chapters: [...Array.from({ length: 51 }, (_, i) => (i + 1).toString()), "35b"] }
},
{
id: 4,
arabic: { title: "سنن أبي داود", author: "الإمام سليمان بن الأشعث أبو داود السجستاني" },
english: { title: "Sunan Abi Dawud", author: "Imam Sulayman ibn al-Ash'ath Abu Dawud al-Sijistani" },
route: { base: "abudawud", chapters: Array.from({ length: 43 }, (_, i) => (i + 1).toString()) }
},
{
id: 5,
arabic: { title: "جامع الترمذي", author: "الإمام أبو عيسى محمد بن عيسى الترمذي" },
english: { title: "Jami' al-Tirmidhi", author: "Imam Abu Isa Muhammad ibn Isa al-Tirmidhi" },
route: { base: "tirmidhi", chapters: Array.from({ length: 49 }, (_, i) => (i + 1).toString()) }
},
{
id: 6,
arabic: { title: "سنن ابن ماجه", author: "الإمام محمد بن يزيد بن ماجه القزويني" },
english: { title: "Sunan Ibn Majah", author: "Imam Muhammad ibn Yazid Ibn Majah al-Qazwini" },
route: { base: "ibnmajah", chapters: ["introduction", ...Array.from({ length: 37 }, (_, i) => (i + 1).toString())] }
},
{
id: 7,
arabic: { title: "موطأ مالك", author: "الإمام مالك بن أنس" },
english: { title: "Muwatta Malik", author: "Imam Malik ibn Anas" },
route: { base: "malik", chapters: Array.from({ length: 61 }, (_, i) => (i + 1).toString()) }
},
{
id: 8,
arabic: { title: "مسند الإمام أحمد بن حنبل", author: "الإمام أحمد بن حنبل" },
english: { title: "Musnad Ahmad ibn Hanbal", author: "Imam Ahmad ibn Hanbal" },
route: { base: "ahmed", chapters: [...Array.from({ length: 7 }, (_, i) => (i + 1).toString()), "31"] }
},
{
id: 9,
arabic: { title: "سنن الدارمي", author: "الإمام أبو محمد عبد الرحمن بن عبد الله بن الدارمي" },
english: { title: "Sunan al-Darimi", author: "Imam Abu Muhammad Abd al-Rahman ibn Abd Allah ibn al-Darimi" },
route: { base: "darimi", chapters: ["introduction", ...Array.from({ length: 23 }, (_, i) => (i + 1).toString())] }
}
];
// Dynamically generate book list
const bookList = document.getElementById('bookList');
books.forEach((book, index) => {
const bookElement = document.createElement('div');
bookElement.classList.add('book-item');
// Wrapping the entire book item in a clickable link
bookElement.innerHTML = `
<a href="books.html?book=${book.route.base}">
<div class="numbering">${index + 1}</div>
<h3>${book.english.title}</h3>
<p><strong>Author:</strong> ${book.english.author}</p>
<p><strong>Chapters:</strong> ${book.route.chapters.length}</p>
</a>
`;
bookList.appendChild(bookElement);
});
// 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>