-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
605 lines (524 loc) · 15.7 KB
/
index.html
File metadata and controls
605 lines (524 loc) · 15.7 KB
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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Athan Clock - Columbia, MD</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Google Font for a futuristic look -->
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800&display=swap" rel="stylesheet" />
<style>
:root {
--bg: #02040a;
--card: #070b18;
--neon: #18e0ff;
--neon-soft: rgba(24, 224, 255, 0.25);
--text-main: #f5f7ff;
--text-dim: #7f8ba6;
--danger: #ff4f7a;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background: radial-gradient(circle at top, #05081a 0, #010208 45%, #000 100%);
color: var(--text-main);
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 1.5rem;
}
.container {
width: 100%;
max-width: 900px;
background: radial-gradient(circle at top left, #0a1028 0, #050814 40%, #02030a 100%);
border-radius: 24px;
padding: 1.8rem 1.6rem 1.8rem;
box-shadow:
0 0 35px rgba(0, 0, 0, 0.9),
0 0 40px rgba(0, 0, 0, 0.8),
0 0 80px var(--neon-soft);
border: 1px solid rgba(24, 224, 255, 0.35);
position: relative;
overflow: hidden;
}
.container::before {
content: "";
position: absolute;
inset: -40%;
background:
radial-gradient(circle at 0 0, rgba(24, 224, 255, 0.15), transparent 55%),
radial-gradient(circle at 100% 0, rgba(120, 220, 255, 0.1), transparent 55%);
opacity: 0.85;
pointer-events: none;
}
.inner {
position: relative;
z-index: 1;
}
.top-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1.25rem;
flex-wrap: wrap;
margin-bottom: 1.25rem;
}
.clock-block {
flex: 2 1 260px;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.time {
font-family: "Orbitron", monospace;
font-size: clamp(2.7rem, 5vw, 3.6rem);
letter-spacing: 0.08em;
display: flex;
align-items: baseline;
gap: 0.3em;
text-shadow:
0 0 14px var(--neon-soft),
0 0 28px var(--neon-soft);
}
.time-colon {
animation: pulse 1s infinite alternate;
}
@keyframes pulse {
from { opacity: 0.35; }
to { opacity: 1; }
}
.ampm {
font-size: 0.45em;
text-transform: uppercase;
color: var(--neon);
letter-spacing: 0.18em;
margin-left: 0.4em;
}
.date-line {
margin-top: 0.15rem;
font-size: 0.9rem;
color: var(--text-dim);
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
align-items: center;
}
.date-line span + span::before {
content: "•";
color: rgba(127, 139, 166, 0.6);
margin: 0 0.35rem 0 0.1rem;
}
.next-block {
flex: 1.3 1 220px;
background: linear-gradient(145deg, rgba(4, 9, 26, 0.9), rgba(3, 10, 22, 0.95));
border-radius: 16px;
padding: 0.9rem 0.9rem 0.85rem;
border: 1px solid rgba(24, 224, 255, 0.35);
box-shadow:
0 0 24px rgba(24, 224, 255, 0.15),
inset 0 0 18px rgba(0, 0, 0, 0.7);
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.next-label {
text-transform: uppercase;
font-size: 0.72rem;
letter-spacing: 0.16em;
color: var(--text-dim);
}
.next-main {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 0.35rem;
}
.next-name {
font-size: 1.1rem;
font-weight: 600;
color: var(--neon);
text-shadow: 0 0 14px var(--neon-soft);
}
.next-time {
font-family: "Orbitron", monospace;
font-size: 0.95rem;
color: var(--text-main);
}
.next-countdown {
font-size: 0.82rem;
color: var(--text-dim);
}
.location {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.16em;
color: rgba(144, 157, 190, 0.9);
margin-top: 0.05rem;
}
.grid {
margin-top: 0.75rem;
background: linear-gradient(145deg, rgba(7, 10, 24, 0.9), rgba(3, 8, 18, 0.96));
border-radius: 16px;
padding: 0.9rem;
border: 1px solid rgba(24, 224, 255, 0.2);
box-shadow:
0 0 30px rgba(0, 0, 0, 0.9),
inset 0 0 18px rgba(1, 3, 10, 0.9);
}
.grid-header {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 0.35rem;
}
.grid-title {
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.14em;
color: var(--text-dim);
}
.grid-subtitle {
font-size: 0.75rem;
color: rgba(144, 157, 190, 0.95);
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 0.25rem;
font-family: "Orbitron", monospace;
font-size: 0.9rem;
}
th, td {
padding: 0.4rem 0.25rem;
text-align: left;
}
th {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.16em;
color: rgba(144, 157, 190, 0.9);
border-bottom: 1px solid rgba(55, 70, 110, 0.9);
}
tr {
transition: background 0.2s ease, transform 0.15s ease;
}
td.name-cell {
font-weight: 600;
color: #c6d0ff;
text-transform: uppercase;
letter-spacing: 0.09em;
font-size: 0.78rem;
}
td.time-cell {
text-align: right;
color: var(--text-main);
}
tr:nth-child(even) {
background: rgba(5, 9, 26, 0.65);
}
tr:nth-child(odd) {
background: rgba(3, 6, 18, 0.85);
}
tr.next-prayer {
background: radial-gradient(circle at left, rgba(24, 224, 255, 0.24), rgba(3, 7, 18, 0.96));
box-shadow:
0 0 22px rgba(24, 224, 255, 0.45),
inset 0 0 18px rgba(0, 0, 0, 0.9);
transform: translateY(-1px);
}
tr.next-prayer td.name-cell {
color: var(--neon);
}
.status-line {
margin-top: 0.55rem;
font-size: 0.75rem;
color: var(--text-dim);
display: flex;
justify-content: space-between;
align-items: center;
gap: 0.5rem;
opacity: 0.9;
}
.status-line span.label {
text-transform: uppercase;
letter-spacing: 0.16em;
font-size: 0.7rem;
}
.status-line span.value {
color: var(--neon);
}
.error {
color: var(--danger);
font-size: 0.78rem;
margin-top: 0.4rem;
}
@media (max-width: 640px) {
.container {
padding: 1.4rem 1.2rem 1.4rem;
border-radius: 20px;
}
.top-row {
flex-direction: column;
}
.next-block {
align-self: stretch;
}
}
</style>
</head>
<body>
<div class="container">
<div class="inner">
<div class="top-row">
<div class="clock-block">
<div class="time">
<span id="clock-hours">--</span><span class="time-colon">:</span><span id="clock-minutes">--</span>
<span class="ampm" id="clock-ampm">--</span>
</div>
<div class="date-line">
<span id="greg-date">Loading date…</span>
<span id="hijri-date"></span>
</div>
</div>
<div class="next-block">
<div class="next-label">Next Prayer</div>
<div class="next-main">
<div class="next-name" id="next-name">--</div>
<div class="next-time" id="next-time">--:--</div>
</div>
<div class="next-countdown" id="next-countdown">Calculating…</div>
<div class="location">Columbia, Maryland • ISNA method</div>
</div>
</div>
<div class="grid">
<div class="grid-header">
<div class="grid-title">Today’s Prayer Times</div>
<div class="grid-subtitle" id="method-label">Loading…</div>
</div>
<table>
<thead>
<tr>
<th>Prayer</th>
<th style="text-align:right;">Time</th>
</tr>
</thead>
<tbody id="prayer-body">
<tr><td class="name-cell">Fajr</td><td class="time-cell" id="time-fajr">--:--</td></tr>
<tr><td class="name-cell">Dhuhr</td><td class="time-cell" id="time-dhuhr">--:--</td></tr>
<tr><td class="name-cell">Asr</td><td class="time-cell" id="time-asr">--:--</td></tr>
<tr><td class="name-cell">Maghrib</td><td class="time-cell" id="time-maghrib">--:--</td></tr>
<tr><td class="name-cell">Isha</td><td class="time-cell" id="time-isha">--:--</td></tr>
</tbody>
</table>
<div class="status-line">
<span class="label">Source</span>
<span class="value">Aladhan.com API (ISNA)</span>
</div>
<div class="error" id="error-msg" style="display:none;"></div>
</div>
</div>
</div>
<script>
// === CONFIG ===
const CITY = "Columbia, MD";
const COUNTRY = "United States";
const METHOD = 2; // ISNA (North America)
const SCHOOL = 0; // 0 = Shafi, 1 = Hanafi
let prayerTimes = null;
let methodName = "";
let hijriDisplay = "";
let gregDisplay = "";
function pad(n) {
return n.toString().padStart(2, "0");
}
function to12Hour(time24) {
// expects "HH:MM"
const [hStr, mStr] = time24.split(":");
let h = parseInt(hStr, 10);
const m = mStr;
const ampm = h >= 12 ? "PM" : "AM";
h = h % 12;
if (h === 0) h = 12;
return { text: `${h}:${m}`, ampm };
}
function updateClock() {
const now = new Date();
let hours = now.getHours();
const minutes = pad(now.getMinutes());
const ampm = hours >= 12 ? "PM" : "AM";
hours = hours % 12;
if (hours === 0) hours = 12;
document.getElementById("clock-hours").textContent = hours;
document.getElementById("clock-minutes").textContent = minutes;
document.getElementById("clock-ampm").textContent = ampm;
if (gregDisplay) {
document.getElementById("greg-date").textContent = gregDisplay;
} else {
const options = { weekday: "long", year: "numeric", month: "long", day: "numeric" };
document.getElementById("greg-date").textContent = now.toLocaleDateString(undefined, options);
}
if (hijriDisplay) {
document.getElementById("hijri-date").textContent = hijriDisplay;
}
if (prayerTimes) {
updateNextPrayer(now);
}
}
function updatePrayerTable() {
if (!prayerTimes) return;
const fields = [
["Fajr", "time-fajr"],
["Dhuhr", "time-dhuhr"],
["Asr", "time-asr"],
["Maghrib", "time-maghrib"],
["Isha", "time-isha"],
];
fields.forEach(([name, id]) => {
const raw = prayerTimes[name];
if (!raw) return;
const twelve = to12Hour(raw);
document.getElementById(id).textContent = twelve.text;
});
document.getElementById("method-label").textContent =
methodName ? methodName : "Method: ISNA (configurable)";
}
function parseTimeToday(baseDate, timeStr) {
// timeStr "HH:MM"
const [hStr, mStr] = timeStr.split(":");
const h = parseInt(hStr, 10);
const m = parseInt(mStr, 10);
return new Date(
baseDate.getFullYear(),
baseDate.getMonth(),
baseDate.getDate(),
h,
m,
0,
0
);
}
function updateNextPrayer(now) {
const order = ["Fajr", "Dhuhr", "Asr", "Maghrib", "Isha"];
const future = [];
order.forEach(name => {
const tStr = prayerTimes[name];
if (!tStr) return;
const dt = parseTimeToday(now, tStr);
if (dt > now) {
future.push({ name, date: dt, raw: tStr });
}
});
let next = null;
if (future.length > 0) {
future.sort((a, b) => a.date - b.date);
next = future[0];
}
const nameEl = document.getElementById("next-name");
const timeEl = document.getElementById("next-time");
const cdEl = document.getElementById("next-countdown");
// Remove highlight classes
Array.from(document.querySelectorAll("#prayer-body tr")).forEach(tr =>
tr.classList.remove("next-prayer")
);
if (!next) {
// After Isha, just show tomorrow Fajr (no exact countdown, to keep it simple)
const fajr = prayerTimes["Fajr"];
const fajr12 = fajr ? to12Hour(fajr) : { text: "--:--" };
nameEl.textContent = "Fajr (tomorrow)";
timeEl.textContent = fajr12.text;
cdEl.textContent = "After Isha – next up is Fajr in shaa Allah.";
return;
}
// Highlight row
const idMap = {
"Fajr": "time-fajr",
"Dhuhr": "time-dhuhr",
"Asr": "time-asr",
"Maghrib": "time-maghrib",
"Isha": "time-isha",
};
const cellId = idMap[next.name];
if (cellId) {
const cell = document.getElementById(cellId);
if (cell && cell.parentElement) {
cell.parentElement.classList.add("next-prayer");
}
}
const twelve = to12Hour(next.raw);
nameEl.textContent = next.name;
timeEl.textContent = twelve.text;
const diffMs = next.date - now;
const diffMinTotal = Math.round(diffMs / 60000);
const hours = Math.floor(diffMinTotal / 60);
const mins = diffMinTotal % 60;
if (diffMinTotal <= 0) {
cdEl.textContent = "Now";
} else {
let parts = [];
if (hours > 0) parts.push(hours + "h");
parts.push(mins + "m");
cdEl.textContent = "In " + parts.join(" ");
}
}
function showError(msg) {
const el = document.getElementById("error-msg");
el.textContent = msg;
el.style.display = "block";
}
function hideError() {
const el = document.getElementById("error-msg");
el.style.display = "none";
}
async function fetchPrayerTimes() {
hideError();
try {
const now = new Date();
const dd = pad(now.getDate());
const mm = pad(now.getMonth() + 1);
const yyyy = now.getFullYear();
const datePath = `${dd}-${mm}-${yyyy}`;
const url =
`https://api.aladhan.com/v1/timingsByCity/${datePath}` +
`?city=${encodeURIComponent(CITY)}` +
`&country=${encodeURIComponent(COUNTRY)}` +
`&method=${METHOD}` +
`&school=${SCHOOL}`;
const res = await fetch(url);
const json = await res.json();
if (json.code !== 200) {
throw new Error(json.status || "API error");
}
const data = json.data;
prayerTimes = {
Fajr: data.timings.Fajr,
Dhuhr: data.timings.Dhuhr,
Asr: data.timings.Asr,
Maghrib: data.timings.Maghrib,
Isha: data.timings.Isha
};
// Nice date strings
gregDisplay = data.date.readable; // e.g. "07 Dec 2025"
const hijri = data.date.hijri;
hijriDisplay = `${hijri.day} ${hijri.month.en} ${hijri.year} AH`;
methodName = data.meta && data.meta.method && data.meta.method.name
? `Method: ${data.meta.method.name}`
: "Method: ISNA";
updatePrayerTable();
} catch (e) {
console.error(e);
showError("Could not load prayer times. Check internet connection or API access.");
}
}
// Initial load
fetchPrayerTimes();
updateClock();
setInterval(updateClock, 1000);
// Refresh prayer times every few hours just in case
setInterval(fetchPrayerTimes, 4 * 60 * 60 * 1000);
</script>
</body>
</html>