-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhadith.html
158 lines (138 loc) · 5.38 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
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>أحاديث أبي داود - Sahih Abu Dawud</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Amiri&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Amiri', serif;
background: url('https://web.opendrive.com/api/v1/download/file.json/ODZfNjkwMzQ1NzNf?temp_key=%AD%A9%9Au%A9%F6%D3yZ%9E%D7%AB%9F%5D%FA%EB%1E%FA%F2%3A%60&inline=1');
text-align: center;
color: #fff;
backdrop-filter: blur(3px);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
header {
text-align: center;
padding: 20px 0;
border-bottom: 2px solid #d4af37;
margin-bottom: 20px;
}
h1 {
font-size: 2.5em;
color: #d4af37;
}
.hadith-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 20px;
padding: 10px;
}
.hadith-card {
background: #fff;
padding: 15px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
color: #000;
text-align: right;
}
.hadith-number {
font-size: 1.1em;
color: #d4af37;
margin-bottom: 10px;
font-weight: bold;
}
.arabic-text {
font-size: 1.3em;
text-align: justify;
margin-bottom: 10px;
line-height: 1.8;
}
.translation {
font-size: 1em;
color: #555;
border-right: 3px solid #d4af37;
padding-right: 10px;
}
.loading {
text-align: center;
font-size: 1.5em;
color: #d4af37;
}
.load-btn {
background-color: #d4af37;
color: #1a1a1a;
font-size: 1.1em;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
border: none;
margin-top: 20px;
}
.load-btn:hover {
background-color: #b8962e;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>سنن أبي داود</h1>
<p>أحاديث النبي محمد صلى الله عليه وسلم</p>
</header>
<div class="hadith-grid" id="hadithContainer">
<div class="loading">جاري تحميل الأحاديث...</div>
</div>
<button id="loadMore" class="load-btn">تحميل المزيد</button>
</div>
<script>
let startIndex = 0;
const batchSize = 20;
let dataAr = [], dataEn = [];
document.addEventListener('DOMContentLoaded', async function() {
const API_VERSION = '1';
const ARABIC_EDITION = 'ara-abudawud';
const ENGLISH_EDITION = 'eng-abudawud';
const API_URL_AR = `https://cdn.jsdelivr.net/gh/fawazahmed0/hadith-api@${API_VERSION}/editions/${ARABIC_EDITION}.json`;
const API_URL_EN = `https://cdn.jsdelivr.net/gh/fawazahmed0/hadith-api@${API_VERSION}/editions/${ENGLISH_EDITION}.json`;
try {
const [resAr, resEn] = await Promise.all([fetch(API_URL_AR), fetch(API_URL_EN)]);
if (!resAr.ok || !resEn.ok) throw new Error('فشل تحميل البيانات');
dataAr = await resAr.json();
dataEn = await resEn.json();
document.getElementById('hadithContainer').innerHTML = '';
loadHadiths(); // Charger les premiers hadiths
} catch (error) {
document.getElementById('hadithContainer').innerHTML = `<p class="loading" style="color: red;">حدث خطأ في تحميل الأحاديث</p>`;
}
});
function loadHadiths() {
const hadithContainer = document.getElementById('hadithContainer');
for (let i = startIndex; i < startIndex + batchSize && i < dataAr.hadiths.length; i++) {
const ar = dataAr.hadiths[i];
const en = dataEn.hadiths[i] || {};
const card = document.createElement('div');
card.className = 'hadith-card';
card.innerHTML = `
<div class="hadith-number">الحديث رقم: ${ar.hadithnumber || 'غير متوفر'}</div>
<div class="arabic-text">${ar.text || 'النص غير متوفر'}</div>
<div class="translation">${en.text || 'الترجمة غير متوفرة'}</div>
`;
hadithContainer.appendChild(card);
}
startIndex += batchSize;
if (startIndex >= dataAr.hadiths.length) {
document.getElementById('loadMore').style.display = 'none';
}
}
document.getElementById('loadMore').addEventListener('click', loadHadiths);
</script>
</body>
</html>