29-03-26, 02:27 AM
الصفحات : 1 2
29-03-26, 02:39 AM
هل تقصد البقاء على التنبيه حتى لو تم اغلاق رسالة التنبيه لمدة 5 دقائق ؟
اذا كان كذلك فهذا التعديل يقوم بذلك .
كما يمكنك ابلاغي مساعدتك باضافة بقية اوقات الصلوات ان اردت
اذا كان كذلك فهذا التعديل يقوم بذلك .
كما يمكنك ابلاغي مساعدتك باضافة بقية اوقات الصلوات ان اردت
PHP كود :
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>تنبيه صلاة الفجر</title>
<style>
#overlay {
display: none;
position: fixed;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
top: 0;
left: 0;
}
#popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
}
#countdown {
font-size: 18px;
margin-top: 20px;
text-align: center;
}
button {
margin-top: 10px;
}
</style>
</head>
<body>
<div id="overlay"></div>
<div id="popup">
<h3>تنبيه صلاة الفجر</h3>
<p>حان الآن وقت صلاة الفجر</p>
<button onclick="temporaryClose()">إغلاق</button>
</div>
<div id="countdown"></div>
<script>
const fajrTime = "05:10";
let endTime;
let popupInterval;
function showPopup() {
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}
function closePopup() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
}
function temporaryClose() {
closePopup();
}
function startFajrAlert() {
endTime = new Date().getTime() + 5 * 60 * 1000;
popupInterval = setInterval(() => {
if (new Date().getTime() >= endTime) {
clearInterval(popupInterval);
closePopup();
} else {
showPopup();
}
}, 1000);
}
function updateCountdown() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
let hours = Math.floor(diff / 1000 / 60 / 60);
let minutes = Math.floor((diff / 1000 / 60) % 60);
let seconds = Math.floor((diff / 1000) % 60);
document.getElementById("countdown").textContent =
`الوقت المتبقي لصلاة الفجر: ${hours} ساعة، ${minutes} دقيقة، ${seconds} ثانية`;
}
function scheduleFajr() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
setTimeout(startFajrAlert, diff);
}
setInterval(updateCountdown, 1000);
scheduleFajr();
updateCountdown();
</script>
</body>
</html>
29-03-26, 02:47 AM
استمر الكود عند اغلاق نافذة التنبيه لاكن عند تحديث الصفحه بعد 10 ثواني لم يخرج التنبيه
29-03-26, 03:45 AM
صحيح احسنت هذه التفاتة مهمة
في حال تحديث الصفحة يتم إعادة حساب الوقت من جديد
الحل هو حفظ وقت انتهاء التنبيه في localStorage حتى يبقى محفوظ حتى بعد التحديث
في حال تحديث الصفحة يتم إعادة حساب الوقت من جديد
الحل هو حفظ وقت انتهاء التنبيه في localStorage حتى يبقى محفوظ حتى بعد التحديث
PHP كود :
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>تنبيه صلاة الفجر</title>
<style>
#overlay {
display: none;
position: fixed;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
top: 0;
left: 0;
}
#popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
}
#countdown {
font-size: 18px;
margin-top: 20px;
text-align: center;
}
button {
margin-top: 10px;
}
</style>
</head>
<body>
<div id="overlay"></div>
<div id="popup">
<h3>تنبيه صلاة الفجر</h3>
<p>حان الآن وقت صلاة الفجر</p>
<button onclick="temporaryClose()">إغلاق</button>
</div>
<div id="countdown"></div>
<script>
const fajrTime = "05:10";
let popupInterval;
function showPopup() {
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}
function closePopup() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
}
function temporaryClose() {
closePopup();
}
function startFajrAlert(savedEndTime = null) {
let endTime = savedEndTime || (new Date().getTime() + 5 * 60 * 1000);
localStorage.setItem("fajrEndTime", endTime);
popupInterval = setInterval(() => {
let now = new Date().getTime();
if (now >= endTime) {
clearInterval(popupInterval);
localStorage.removeItem("fajrEndTime");
closePopup();
} else {
showPopup();
}
}, 1000);
}
function updateCountdown() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
let hours = Math.floor(diff / 1000 / 60 / 60);
let minutes = Math.floor((diff / 1000 / 60) % 60);
let seconds = Math.floor((diff / 1000) % 60);
document.getElementById("countdown").textContent =
`الوقت المتبقي لصلاة الفجر: ${hours} ساعة، ${minutes} دقيقة، ${seconds} ثانية`;
}
function scheduleFajr() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
setTimeout(() => startFajrAlert(), diff);
}
function checkSavedAlert() {
let savedEndTime = localStorage.getItem("fajrEndTime");
if (savedEndTime) {
startFajrAlert(parseInt(savedEndTime));
}
}
setInterval(updateCountdown, 1000);
checkSavedAlert();
scheduleFajr();
updateCountdown();
</script>
</body>
</html>
29-03-26, 03:53 AM
اسف طولت معك
لم يعمل الكود الاخير
عمل الكود بارك الله فيك
لاكن لو امكن عند اغلاق النافذه لا يعاود فتحها
الكود الاخير لم يظبط بعد انتهاء مدة التنبيه يستمر خروج النافذه
لم يعمل الكود الاخير
عمل الكود بارك الله فيك
لاكن لو امكن عند اغلاق النافذه لا يعاود فتحها
الكود الاخير لم يظبط بعد انتهاء مدة التنبيه يستمر خروج النافذه
29-03-26, 04:28 AM
لا لا ابداً ما فيه تاخير ولا شي
الحل: نميز بين الحالتين
قبل انتهاء الوقت -------إغلاق مؤقت
[*]بعد انتهاء الوقت ------- إغلاق نهائي
طيب بالحالة ذي انت تحتاج امر اغلاق ( اغلاق نهائي )
تأجيل يخفيه مؤقت ويرجع يفتح (مثلاً بعد 1 دقيقة حتى انقضاء مدة المهلة )
الحل: نميز بين الحالتين
قبل انتهاء الوقت -------إغلاق مؤقت
[*]بعد انتهاء الوقت ------- إغلاق نهائي
PHP كود :
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>تنبيه صلاة الفجر</title>
<style>
#overlay {
display: none;
position: fixed;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
top: 0;
left: 0;
}
#popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
}
#countdown {
font-size: 18px;
margin-top: 20px;
text-align: center;
}
button {
margin-top: 10px;
}
</style>
</head>
<body>
<div id="overlay"></div>
<div id="popup">
<h3>تنبيه صلاة الفجر</h3>
<p>حان الآن وقت صلاة الفجر</p>
<button onclick="temporaryClose()">إغلاق</button>
</div>
<div id="countdown"></div>
<script>
const fajrTime = "3:20";
let popupInterval;
let endTime = null;
function showPopup() {
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}
function closePopup() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
}
function temporaryClose() {
let now = new Date().getTime();
if (now >= endTime) {
clearInterval(popupInterval);
localStorage.removeItem("fajrEndTime");
closePopup();
} else {
closePopup();
}
}
function startFajrAlert(savedEndTime = null) {
endTime = savedEndTime || (new Date().getTime() + 5 * 60 * 1000);
localStorage.setItem("fajrEndTime", endTime);
popupInterval = setInterval(() => {
let now = new Date().getTime();
if (now >= endTime) {
closePopup();
} else {
showPopup();
}
}, 1000);
}
function updateCountdown() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
let hours = Math.floor(diff / 1000 / 60 / 60);
let minutes = Math.floor((diff / 1000 / 60) % 60);
let seconds = Math.floor((diff / 1000) % 60);
document.getElementById("countdown").textContent =
`الوقت المتبقي لصلاة الفجر: ${hours} ساعة، ${minutes} دقيقة، ${seconds} ثانية`;
}
function scheduleFajr() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
setTimeout(() => startFajrAlert(), diff);
}
function checkSavedAlert() {
let savedEndTime = localStorage.getItem("fajrEndTime");
if (savedEndTime) {
startFajrAlert(parseInt(savedEndTime));
}
}
setInterval(updateCountdown, 1000);
checkSavedAlert();
scheduleFajr();
updateCountdown();
</script>
</body>
</html>
(29-03-26, 03:53 AM)nnnjk كتب : [ -> ]لاكن لو امكن عند اغلاق النافذه لا يعاود فتحها
طيب بالحالة ذي انت تحتاج امر اغلاق ( اغلاق نهائي )
تأجيل يخفيه مؤقت ويرجع يفتح (مثلاً بعد 1 دقيقة حتى انقضاء مدة المهلة )
29-03-26, 04:48 AM
تسلم
حتى بعد اغلاق النافذه يفتح مجددا
تسلم
حتى بعد اغلاق النافذه يفتح مجددا
الكود غير مظبوط
حتى بعد انتهاء مدة التنبيه يعاود التنبيه
حتى بعد اغلاق النافذه يفتح مجددا
تسلم
حتى بعد اغلاق النافذه يفتح مجددا
الكود غير مظبوط
حتى بعد انتهاء مدة التنبيه يعاود التنبيه
29-03-26, 04:52 AM
طيب الحين سؤال ما مهمة ال 5 دقائق ؟
طالما المستخدم خلاص قام باغلاق التنبيه
و المطلوب الان عدم اعادة اظهار التنبيه
علماً بأن الخمسة دقائق لم تنته بعد ..
خلاص الان اتضحت لي الفكرة .
بعد اعلان وقت الصلاة الفعلي يظهر التنبيه الاول
ثم بعد ذلك 5 دقائق ياتي تنبيه التذكير بقضاء الصلاة
هل هذا هو المطلوب؟
طالما المستخدم خلاص قام باغلاق التنبيه
و المطلوب الان عدم اعادة اظهار التنبيه
علماً بأن الخمسة دقائق لم تنته بعد ..
خلاص الان اتضحت لي الفكرة .
بعد اعلان وقت الصلاة الفعلي يظهر التنبيه الاول
ثم بعد ذلك 5 دقائق ياتي تنبيه التذكير بقضاء الصلاة
هل هذا هو المطلوب؟
29-03-26, 06:10 AM
PHP كود :
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>تنبيه صلاة الفجر</title>
<style>
#overlay {
display: none;
position: fixed;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
top: 0;
left: 0;
}
#popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
}
#countdown {
font-size: 18px;
margin-top: 20px;
text-align: center;
}
button {
margin-top: 10px;
}
</style>
</head>
<body>
<div id="overlay"></div>
<div id="popup">
<h3 id="popupTitle">تنبيه صلاة الفجر</h3>
<p id="popupMsg">حان الآن وقت صلاة الفجر</p>
<button onclick="closePopupAndStartReminder()">إغلاق</button>
</div>
<div id="countdown"></div>
<script>
let fajrTime = "04:07"; // وقت الفجر المحدد مسبقًا
let reminderTimeout;
let reminderShown = false;
function showPopup(title = "تنبيه", msg = "حان الآن وقت الصلاة") {
document.getElementById("popupTitle").textContent = title;
document.getElementById("popupMsg").textContent = msg;
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}
function closePopup() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
}
function closePopupAndStartReminder() {
closePopup();
if (!reminderShown) {
let endReminderTime = new Date().getTime() + 5 * 60 * 1000;
localStorage.setItem("fajrReminderEnd", endReminderTime);
startReminderCountdown(endReminderTime);
}
}
function startReminderCountdown(endTime) {
reminderShown = true;
reminderTimeout = setInterval(() => {
let now = new Date().getTime();
if (now >= endTime) {
clearInterval(reminderTimeout);
localStorage.removeItem("fajrReminderEnd");
showPopup("تذكير", "يرجى قضاء صلاة الفجر");
}
}, 1000);
}
function startFajrAlert() {
showPopup("تنبيه صلاة الفجر", "حان الآن وقت صلاة الفجر");
}
function checkSavedReminder() {
let savedEndTime = localStorage.getItem("fajrReminderEnd");
if (savedEndTime) {
let now = new Date().getTime();
if (now < parseInt(savedEndTime)) {
startReminderCountdown(parseInt(savedEndTime));
} else {
localStorage.removeItem("fajrReminderEnd");
}
}
}
function updateCountdown() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
let hours = Math.floor(diff / 1000 / 60 / 60);
let minutes = Math.floor((diff / 1000 / 60) % 60);
let seconds = Math.floor((diff / 1000) % 60);
document.getElementById("countdown").textContent =
`الوقت المتبقي لصلاة الفجر: ${hours} ساعة، ${minutes} دقيقة، ${seconds} ثانية`;
}
function scheduleFajr() {
let now = new Date();
let [hour, minute] = fajrTime.split(":");
let fajrDate = new Date();
fajrDate.setHours(parseInt(hour));
fajrDate.setMinutes(parseInt(minute));
fajrDate.setSeconds(0);
if (fajrDate < now) {
fajrDate.setDate(fajrDate.getDate() + 1);
}
let diff = fajrDate - now;
setTimeout(startFajrAlert, diff);
}
setInterval(updateCountdown, 1000);
checkSavedReminder();
scheduleFajr();
updateCountdown();
</script>
</body>
</html>
الصفحات : 1 2