-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtimer.php
349 lines (245 loc) · 11.9 KB
/
timer.php
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
<?php
include('./scripts/view_settings.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>iMasjid Timer</title>
<meta content="" name="descriptison">
<meta content="" name="keywords">
<!-- Vendor CSS Files -->
<link href="./assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- FontAwesome / ionicons-->
<link rel="stylesheet" href="./assets/vendor/fontawesome/css/fontawesome.css">
<link rel="stylesheet" href="./assets/vendor/fontawesome/css/regular.css">
<link rel="stylesheet" href="./assets/vendor/fontawesome/css/solid.css">
<!-- Template Main CSS File -->
<link href="./assets/css/timer.css" rel="stylesheet">
</head>
<audio id="timer-beep">
<source src="./sounds/Sounds-4.mp3" type="audio/mpeg">
</audio>
<audio id="timer-beep2">
<source src="./sounds/Sounds-3.mp3" type="audio/mpeg">
</audio>
<body onload="startTime()">
<section id="hero" class="d-flex align-items-center" style="background-image: url(./assets/images/background/timer-bg.jpg)">
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-xl-12 col-lg-12 text-center">
<h1 id="label"></h1>
</div>
</div>
<div class="row justify-content-center">
<div class="col-sm-4">
<div class="card text-center">
<div class="card-header">Menit</div>
<div class="card-body">
<h3 class="card-title" id="menit"></h3>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card text-center">
<div class="card-header">Detik</div>
<div class="card-body">
<h3 class="card-title" id="detik"></h3>
</div>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-xl-12 col-lg-12 text-center">
<h2 id="message"></h2>
</div>
</div>
</div>
</section>
</body>
<script>
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
// Variable untuk bulan masehi
var tanggal = today.getDate();
var bulan = today.getMonth();
var tahun = today.getFullYear();
switch(bulan) {
case 0: bulan = "Jan"; break;
case 1: bulan = "Feb"; break;
case 2: bulan = "Mar"; break;
case 3: bulan = "Apr"; break;
case 4: bulan = "May"; break;
case 5: bulan = "Jun"; break;
case 6: bulan = "Jul"; break;
case 7: bulan = "Aug"; break;
case 8: bulan = "Sep"; break;
case 9: bulan = "Oct"; break;
case 10: bulan = "Nov"; break;
case 11: bulan = "Dec"; break;
}
var val1 = new URLSearchParams(window.location.search);
var val2 = new URLSearchParams(window.location.search);
var val3 = new URLSearchParams(window.location.search);
var icon = "<div class='spinner-border text-primary' role='status'><span class='sr-only'>Loading...</span></div>";
var spinner = " <div class='spinner-grow text-primary' role='status'><span class='sr-only'>Loading...</span></div>";
var url = "<?php echo $_SERVER['HTTP_HOST'] ?>";
var prayername = val1.get("prayer").toLowerCase();
var prayertime = val2.get("time");
var day = val3.get("day").toLowerCase();
var teks_sebelum_adzan = "<?php echo $teks_sebelum_adzan ?>"
var teks_adzan = "<?php echo $teks_adzan ?>"
var teks_iqomah = "<?php echo $teks_iqomah ?>"
var teks_sebelum_sholat = "<?php echo $teks_sebelum_sholat ?>"
var countDownDate = new Date(bulan + " " + tanggal + "," + tahun + " " + prayertime + ":00").getTime();
var w = setInterval(function()
{
var now = new Date().getTime();
var t = countDownDate - now;
var minutes1 = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
var seconds1 = Math.floor((t % (1000 * 60)) / 1000);
minutes1 = checkTime(minutes1);
seconds1 = checkTime(seconds1);
var syuruq = "<?php echo $prayer2 ?>"
if (prayername == syuruq.toLowerCase() ) {
document.getElementById("label").innerHTML = "Memasuki waktu " + prayername;
document.getElementById("message").innerHTML = "";
} else {
document.getElementById("label").innerHTML = "Menanti adzan " + prayername;
document.getElementById("message").innerHTML = teks_sebelum_adzan;
}
document.getElementById("menit").innerHTML = minutes1;
document.getElementById("detik").innerHTML = seconds1;
if (t < 0) {
clearInterval(w);
if (prayername == syuruq.toLowerCase()) {
var timer = setTimeout(function() {
window.location="http://" + url + "/imasjid/message_syuruq.php"
}, 500);
}
playBeep();
document.getElementById("label").innerHTML = icon;
document.getElementById("message").innerHTML = "";
document.getElementById("menit").innerHTML = "";
document.getElementById("detik").innerHTML = "";
// Hitung mundur Adzan
var durasi = "<?php echo $durasi_adzan ?>"
var first2digitTime = prayertime.toString().substr(0,2);
var last2digitTime = prayertime.toString().substr(-2);
var getMinutes = ( Number(last2digitTime) + Number(durasi) );
if(getMinutes > 60) {
var hour = Number(first2digitTime) + Number(1);
var minutes = Number(getMinutes) - Number(60);
} else if(getMinutes == 60) {
var hour = Number(first2digitTime) + Number(1);
var minutes = 0;
} else {
var hour = Number(first2digitTime);
var minutes = Number(last2digitTime) + Number(durasi);
}
hour = checkTime(hour);
minutes = checkTime(minutes);
var counter1 = hour + ":" + minutes;
var countDownDate2 = new Date(bulan + " " + tanggal + "," + tahun + " " + counter1 + ":00").getTime();
var x = setInterval(function()
{
var now = new Date().getTime();
var t = countDownDate2 - now;
var minutes2 = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
var seconds2 = Math.floor((t % (1000 * 60)) / 1000);
minutes2 = checkTime(minutes2);
seconds2 = checkTime(seconds2);
document.getElementById("label").innerHTML = "Adzan " + prayername;
document.getElementById("message").innerHTML = teks_adzan;
document.getElementById("menit").innerHTML = minutes2;
document.getElementById("detik").innerHTML = seconds2;
if (t < 0) {
clearInterval(x);
if (prayername == day) {
var timer = setTimeout(function() {
window.location="http://" + url + "/imasjid/message_jumat.php"
}, 500);
}
document.getElementById("label").innerHTML = icon;
document.getElementById("message").innerHTML = "";
document.getElementById("menit").innerHTML = "";
document.getElementById("detik").innerHTML = "";
// Counter Iqomah berdasarkan nama sholat
var prayer1 = "<?php echo $prayer1 ?>"
var prayer3 = "<?php echo $prayer3 ?>"
var prayer4 = "<?php echo $prayer4 ?>"
var prayer5 = "<?php echo $prayer5 ?>"
var prayer6 = "<?php echo $prayer6 ?>"
if(prayername == prayer1.toLowerCase() ) {
var durasi = "<?php echo $iqomah_shubuh ?>"
} else if(prayername == prayer3.toLowerCase() ) {
var durasi = "<?php echo $iqomah_dzuhur ?>"
} else if(prayername == prayer4.toLowerCase() ) {
var durasi = "<?php echo $iqomah_ashar ?>"
} else if(prayername == prayer5.toLowerCase() ) {
var durasi = "<?php echo $iqomah_maghrib ?>"
} else if(prayername == prayer6.toLowerCase() ) {
var durasi = "<?php echo $iqomah_isya ?>"
}
var first2digitTime = counter1.toString().substr(0,2);
var last2digitTime = counter1.toString().substr(-2);
var getMinutes = ( Number(last2digitTime) + Number(durasi) );
if(getMinutes > 60) {
var hour = Number(first2digitTime) + Number(1);
var minutes = Number(getMinutes) - Number(60);
} else if(getMinutes == 60) {
var hour = Number(first2digitTime) + Number(1);
var minutes = 0;
} else {
var hour = Number(first2digitTime);
var minutes = Number(last2digitTime) + Number(durasi);
}
hour = checkTime(hour);
minutes = checkTime(minutes);
var counter2 = hour + ":" + minutes;
var countDownDate3 = new Date(bulan + " " + tanggal + "," + tahun + " " + counter2 + ":00").getTime();
var y = setInterval(function()
{
var now = new Date().getTime();
var t = countDownDate3 - now;
var minutes3 = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
var seconds3 = Math.floor((t % (1000 * 60)) / 1000);
minutes3 = checkTime(minutes3);
seconds3 = checkTime(seconds3);
document.getElementById("label").innerHTML = "IQOMAH";
document.getElementById("message").innerHTML = teks_iqomah;
document.getElementById("menit").innerHTML = minutes3;
document.getElementById("detik").innerHTML = seconds3;
if (t < 0) {
clearInterval(y);
playBeep2();
var timer = setTimeout(function() {
window.location="http://" + url + "/imasjid/message_sholat.php"
}, 500);
document.getElementById("label").innerHTML = icon;
document.getElementById("message").innerHTML = "";
document.getElementById("menit").innerHTML = "";
document.getElementById("detik").innerHTML = "";
} // End 3rd t statement
},1000);
} // End 2nd t statement
},1000);
} // End 1st t statement
},1000);
} // End function startTime
function checkTime(i) {
if (i < 10) { i = "0" + i };
return i;
}
function playBeep(){
document.getElementById("timer-beep").play();
}
function playBeep2(){
document.getElementById("timer-beep2").play();
}
</script>
</html>