/* Add custom Js code below */
/* الشاشة المنبثقة للتواصل واتساب */
document.addEventListener("DOMContentLoaded", function () {
const hasSeenPopup = localStorage.getItem("roveixPopupShown");
// WhatsApp Floating Icon
const whatsIcon = document.createElement("div");
whatsIcon.id = "roveixWhatsIcon";
whatsIcon.innerHTML = `
`;
whatsIcon.onclick = function () {
showPopup(); // إعادة عرض النافذة
};
document.body.appendChild(whatsIcon);
function showPopup() {
const existingPopup = document.getElementById("roveixPopup");
if (existingPopup) existingPopup.remove();
const popupHTML = `
`;
document.body.insertAdjacentHTML("beforeend", popupHTML);
document.getElementById("roveixWhatsIcon").style.display = "none";
}
if (!hasSeenPopup) {
window.addEventListener("scroll", function onScroll() {
const scrollPosition = window.scrollY + window.innerHeight;
const documentHeight = document.body.scrollHeight;
if (scrollPosition >= documentHeight / 2) {
showPopup();
localStorage.setItem("roveixPopupShown", "true");
window.removeEventListener("scroll", onScroll);
}
});
} else {
// إذا تم عرضها من قبل، نعرض فقط الأيقونة
whatsIcon.style.display = "flex";
}
});
/* ربط احصائيات قوقل للزيارات */
(function() {
var gtagScript = document.createElement('script');
gtagScript.async = true;
gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-SPRCN4H2GH';
document.head.appendChild(gtagScript);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
window.gtag = gtag;
gtag('js', new Date());
gtag('config', 'G-SPRCN4H2GH');
})();