File size: 8,073 Bytes
0ee7c7c
 
 
 
 
8931226
0ee7c7c
8931226
0ee7c7c
8931226
 
0ee7c7c
8931226
 
0ee7c7c
 
 
8931226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ee7c7c
8931226
0ee7c7c
 
8931226
 
 
 
 
 
 
 
 
 
0ee7c7c
 
8931226
0ee7c7c
8931226
0ee7c7c
 
8931226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ee7c7c
8931226
 
0ee7c7c
8931226
 
0ee7c7c
 
8931226
 
0ee7c7c
 
8931226
 
 
 
 
 
 
 
0ee7c7c
8931226
 
 
 
 
0ee7c7c
 
8931226
 
 
 
 
 
 
0ee7c7c
 
8931226
 
 
 
 
0ee7c7c
8931226
 
 
 
 
 
 
0ee7c7c
8931226
0ee7c7c
 
 
8931226
 
 
 
 
 
 
 
0ee7c7c
8931226
 
 
 
 
 
 
 
 
 
 
 
0ee7c7c
8931226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ee7c7c
8931226
 
 
defb525
8931226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ee7c7c
 
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
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>القرآن الكريم والأذكار</title>
    <style>
        /* تصميم عام */
        body {
            font-family: 'Traditional Arabic', serif; /* خط عربي مناسب */
            background-color: #f8f9fa;
            margin: 0;
            color: #343a40;
            line-height: 1.6;
        }

        .container {
            width: 90%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        /* رأس الصفحة */
        header {
            background-color: #343a40;
            color: #fff;
            text-align: center;
            padding: 30px 0;
            margin-bottom: 30px;
            border-bottom: 5px solid #f7d794; /* لمسة جمالية */
        }
        header h1 {
            margin: 0;
            font-size: 3em;
            font-weight: bold;
        }
		header p{
			font-size: 1.2rem;
		}

        /* أقسام المحتوى */
        .section {
            margin-bottom: 40px;
            padding: 20px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        .section h2 {
            color: #343a40;
            font-size: 2em;
            margin-bottom: 20px;
            border-bottom: 2px solid #e9ecef;
            padding-bottom: 10px;
        }

        /* تصميم القرآن */
         #quran-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            flex-wrap: wrap; /* للسماح بالانتقال إلى سطر جديد على الشاشات الصغيرة */
        }

        #quran-select, #reciter-select {
            flex: 1; /* يتقاسمان المساحة بالتساوي */
            padding: 10px;
            margin-right: 10px;
            margin-bottom: 10px;
            border: 1px solid #ced4da;
            border-radius: 5px;
            font-size: 1em;
			min-width: 200px;
        }
		#reciter-select{
			margin-right: 0;
		}

        #play-button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            transition: background-color 0.3s;
        }

        #play-button:hover {
            background-color: #388e3c;
        }


        #quran-audio {
            width: 100%; /* يملأ عرض الحاوية */
			margin-top: 1rem;

        }
		/* تصميم  الأذكار */
        #azkar-list{
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /*  شبكة متجاوبة */
            gap: 20px;
            padding: 0;
            list-style: none;
			
        }

        #azkar-list li {
           background-color: #f8f9fa;
           border: 1px solid #dee2e6;
           padding: 15px;
           border-radius: 5px;
           text-align: center;
           transition: transform 0.2s, box-shadow 0.2s;

        }
		#azkar-list li:hover{
			transform: translateY(-5px);
			box-shadow: 0 6px 12px rgba(0,0,0, 0.15);
		}


        /* تذييل */
        footer {
            text-align: center;
            padding: 20px;
            background-color: #343a40;
            color: #fff;
            margin-top: 40px;
        }

    </style>
</head>
<body>

    <header>
		<div class="container">
        	<h1>القرآن الكريم والأذكار</h1>
			<p>استمع إلى القرآن الكريم وتصفح الأذكار اليومية</p>
		</div>
    </header>

    <div class="container">
        <section id="quran" class="section">
            <h2>القرآن الكريم</h2>
            <div id="quran-controls">
                <select id="quran-select">
                    <option value="">اختر السورة</option>
                    <!--  أسماء السور من  JavaScript -->
                </select>
				 <select id="reciter-select">
                    <option value="">اختر القارئ</option>
                    <!--  أسماء القراء  JavaScript -->
                </select>
                <button id="play-button">تشغيل</button>
            </div>
            <audio id="quran-audio" controls></audio>

        </section>

        <section id="azkar" class="section">
            <h2>الأذكار</h2>
            <ul id="azkar-list">
                <!-- أمثلة (سيتم التعديل عليها لاحقا)-->
                <li>سبحان الله</li>
                <li>الحمد لله</li>
                <li>لا إله إلا الله</li>
                <li>الله أكبر</li>
                <li>أستغفر الله</li>
                <li>لا حول ولا قوة إلا بالله</li>
            </ul>
        </section>
    </div>

    <footer>
        <div class="container">
         <p>جميع الحقوق محفوظة © 2025 JAOUADAZIZI@2025</p>
		</div>
    </footer>

    <script>
       const quranApiUrl = "https://api.quran.com/api/v4/";
		const audioApiBaseUrl = "https://api.quran.com/api/v4/chapter_recitations/"; // + reciter ID + chapter ID
		
		//  دالة لجلب  أسماء السور
		async function getSurahs() {
			try {
				const response = await fetch(`${quranApiUrl}chapters?language=ar`);
				const data = await response.json();
				const surahs = data.chapters;
				const selectElement = document.getElementById("quran-select");

				surahs.forEach(surah => {
					const option = document.createElement("option");
					option.value = surah.id;
					option.textContent = `${surah.id} - ${surah.translated_name.name}`;
					selectElement.appendChild(option);
				});
			} catch (error) {
				console.error("Error fetching Surahs:", error);
				//  رسالة خطأ للمستخدم
			}
		}

		// دالة لجلب قائمة القراء المتاحين
		async function getReciters() {
			try {
				//  هذا  API  قد لا يوفر قائمة كاملة بالقراء.
				//  قد تحتاج إلى قائمة محددة مسبقًا أو  API  آخر.
				//  هنا مثال لقائمة صغيرة
				const reciters = [
					{ id: 7, name: "مشاري العفاسي" },
					{ id: 1, name: "عبد الباسط عبد الصمد" },
					{id: 2, name: "ابوبكر الشاطري"}
					// ...  يمكنك إضافة المزيد من القراء هنا ...
				];

				const reciterSelect = document.getElementById("reciter-select");
				reciters.forEach(reciter => {
					const option = document.createElement("option");
					option.value = reciter.id;
					option.textContent = reciter.name;
					reciterSelect.appendChild(option);
				});

			} catch (error){
				console.error("Error fetching reciters", error);
			}
		}


		// دالة لتشغيل التلاوة
		function playAudio(surahId, reciterId) {
			const audioUrl = `${audioApiBaseUrl}${reciterId}/${surahId}`;
			const audioElement = document.getElementById("quran-audio");

			// جلب رابط الملف الصوتي من ال API
			fetch(audioUrl)
			.then(response => response.json())
			.then(data => {

				audioElement.src = data.audio_file.audio_url;
				audioElement.play();
			})
			.catch(error => {
				console.error("Error Play Audio", error)
			})
		}

		// ربط الأحداث
		document.getElementById("play-button").addEventListener("click", () => {
			const surahId = document.getElementById("quran-select").value;
			const reciterId = document.getElementById("reciter-select").value;

			if (surahId && reciterId) {
				playAudio(surahId, reciterId);
			} else {
				alert("الرجاء اختيار السورة والقارئ.");
			}
		});

		// تحميل البيانات عند بدء التشغيل
		getSurahs();
		getReciters();

    </script>

</body>
</html>