let esm = "معاني";
let link = "https://api.whatsapp.com/send?phone=966550323260&text=%D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85%20%D8%B9%D9%84%D9%8A%D9%83%D9%85%20%D8%8C%20%D8%A3%D8%A8%D9%8A%20%D9%85%D8%B9%D8%B1%D9%81%D8%A9%20%D8%A7%D9%84%D8%AE%D8%AF%D9%85%D8%A7%D8%AA%20%D8%A7%D9%84%D9%85%D9%82%D8%AF%D9%85%D8%A9%20%D9%85%D9%86%20%D9%85%D8%B9%D8%A7%D9%86%D9%8A";
document.addEventListener("DOMContentLoaded", function () {
document.querySelector(".copyright-text p").innerHTML = `
تم التصميم بواسطة
${esm}
| 2024
`;
});
//------------
document.addEventListener('DOMContentLoaded', function () {
// إنشاء الرابط
const whatsappLink = document.createElement('a');
whatsappLink.href = 'https://wa.me/+966500691403'; // حط رقمك هنا مع كود الدولة
whatsappLink.target = '_blank';
whatsappLink.style.position = 'fixed';
whatsappLink.style.bottom = '20px';
whatsappLink.style.right = '20px';
whatsappLink.style.width = '60px';
whatsappLink.style.height = '60px';
whatsappLink.style.backgroundColor = '#25D366';
whatsappLink.style.borderRadius = '50%';
whatsappLink.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
whatsappLink.style.display = 'flex';
whatsappLink.style.alignItems = 'center';
whatsappLink.style.justifyContent = 'center';
whatsappLink.style.zIndex = '1000';
// إضافة أيقونة واتساب كصورة SVG
whatsappLink.innerHTML = `
`;
// إضافة الرابط إلى الصفحة
document.body.appendChild(whatsappLink);
});
// 📌 1. Lazy load لكل الصور و iframes
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("img, iframe").forEach(el => {
if (!el.getAttribute("loading")) {
el.setAttribute("loading", "lazy");
}
});
console.log("✅ Lazy load applied on images & iframes");
});
// 📌 2. تأجيل السكربتات الخارجية لحد ما الصفحة تخلص تحميل
window.addEventListener("load", () => {
document.querySelectorAll("script[src]").forEach(script => {
// نتأكد إن مش سكربت أساسي زي jQuery أو app.js
if (!/app\.js|main|home/.test(script.src)) {
script.setAttribute("defer", "true");
}
});
console.log("✅ Scripts deferred successfully");
});
// 📌 3. تحميل مؤجل لأي أكواد تقيلة بعد 3 ثواني
setTimeout(() => {
// مثال: تحميل تشات أو أناليتكس لو محتاج
// const chat = document.createElement("script");
// chat.src = "https://example.com/chat.js";
// document.body.appendChild(chat);
console.log("✅ Heavy scripts delayed and ready to load if needed");
}, 3000);
// 📌 4. تحسين التاتش ع الموبايل
document.addEventListener("touchstart", function(){}, {passive:true});
console.log("✅ Mobile touch optimization applied");