document.addEventListener("DOMContentLoaded", () => { // 1. منطق واتساب (WhatsApp Animation) const waLink = document.querySelector("#wa-angel a"); if (waLink && !waLink.querySelector(".wa-flip-wrapper")) { const imgSrc = "https://cdn.salla.sa/cdn-cgi/image/fit=scale-down,width=400,height=400,onerror=redirect,format=auto/ePvZmv/azAxP65QHH0TZKszYlaVFpPprapRoLfNSoCcKiXg.png"; const originalIcon = waLink.innerHTML; waLink.innerHTML = ""; const flipWrapper = document.createElement("div"); flipWrapper.className = "wa-flip-wrapper"; flipWrapper.innerHTML = `
${originalIcon}
Profile
خدمة العملاء 7/24
`; waLink.appendChild(flipWrapper); setInterval(() => { flipWrapper.classList.toggle("is-flipped"); }, 4500); } // 2. تفعيل التلاشي للعناصر (IntersectionObserver) const elements = document.querySelectorAll( ".sbauth, .s-product-card, section", ); if (elements.length) { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add("reveal-visible"); observer.unobserve(entry.target); } }); }, { threshold: 0.1 }, ); elements.forEach((el) => observer.observe(el)); } // 3. إضافة أيقونة LinkedIn function addLinkedinIcon() { const socialLists = document.querySelectorAll(".s-social-list"); socialLists.forEach((socialList) => { if (socialList.querySelector(".linkedin-custom")) return; const linkedinLi = document.createElement("li"); linkedinLi.className = "s-social-link linkedin-custom"; linkedinLi.style.display = "inline-block"; linkedinLi.innerHTML = ``; socialList.appendChild(linkedinLi); }); } addLinkedinIcon(); new MutationObserver(addLinkedinIcon).observe(document.body, { childList: true, subtree: true, }); });