🕌 Zift Studio | Ezan Vakitleri
Konum tabanlı günlük namaz vakitleri ve takip sistemi
📍 Otomatik Konum
Şehir seçiniz...
🌙 Gece Modu
Konum bilgisi alınıyor...
`; } // Geri sayım başlat function startCountdown() { if (countdownInterval) clearInterval(countdownInterval); countdownInterval = setInterval(() => { const now = new Date(); const currentTime = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds(); const prayerKeys = ['Imsak', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha']; const prayerNames = ['İmsak', 'Güneş', 'Öğle', 'İkindi', 'Akşam', 'Yatsı']; let nextPrayer = null; let nextPrayerName = ''; let nextPrayerKey = ''; for (let i = 0; i < prayerKeys.length; i++) { const time = currentPrayerTimes[prayerKeys[i]]; const [hours, minutes] = time.split(':').map(Number); const prayerTime = hours * 3600 + minutes * 60; if (prayerTime > currentTime) { nextPrayer = prayerTime; nextPrayerName = prayerNames[i]; nextPrayerKey = prayerKeys[i]; break; } } // Eğer bugün için vakit kalmadıysa, yarının ilk vaktine geç if (!nextPrayer) { const time = currentPrayerTimes['Imsak']; const [hours, minutes] = time.split(':').map(Number); nextPrayer = (24 * 3600) + (hours * 3600 + minutes * 60); nextPrayerName = 'İmsak'; nextPrayerKey = 'Imsak'; } const diff = nextPrayer - currentTime; const hours = Math.floor(diff / 3600); const minutes = Math.floor((diff % 3600) / 60); const seconds = diff % 60; const countdownEl = document.getElementById('countdown'); const nextPrayerNameEl = document.getElementById('nextPrayerName'); const nextPrayerBadge = document.getElementById('nextPrayerBadge'); if (countdownEl) { countdownEl.textContent = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; } if (nextPrayerNameEl) { nextPrayerNameEl.textContent = `${nextPrayerName} Vaktine Kalan Süre`; } if (nextPrayerBadge) { nextPrayerBadge.textContent = `Sıradaki: ${nextPrayerName}`; } // Aktif vakti işaretle document.querySelectorAll('.prayer-card').forEach(card => { card.classList.remove('active'); if (card.dataset.prayer === nextPrayerKey) { card.classList.add('active'); } }); // Vakit girdiğinde bildirim if (diff === 1) { showPrayerNotification(nextPrayerName); } }, 1000); } // Vakit bildirimi function showPrayerNotification(prayerName) { if (Notification.permission === 'granted') { new Notification('🕌 Ezan Vakti Girdi!', { body: `${prayerName} vakti girmiştir. Hayırlı namazlar dileriz.`, icon: 'data:image/svg+xml,
🕌
', badge: 'data:image/svg+xml,
🌙
' }); } } // Bildirim izni iste if ('Notification' in window && Notification.permission === 'default') { Notification.requestPermission(); } // Ay ismi function getMonthName(month) { const months = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık']; return months[month - 1]; } // Başlat getLocation(); // Her 1 dakikada bir güncelle (vakitlerin değişmesi için) setInterval(() => { if (currentPrayerTimes) { getLocation(); } }, 60000);