document.addEventListener("DOMContentLoaded", function () { /* =============================== 🟦 شريط جانبي ثابت للتبرع =============================== */ if (!document.getElementById("floatingSidebar")) { const links = { fastDonate: "https://masarcharity.com/%D8%AD%D8%A7%D9%84%D8%A7%D8%AA-%D8%A5%D9%86%D8%B3%D8%A7%D9%86%D9%8A%D8%A9/c910263623", giftDonate: "https://masarcharity.com/%D8%AD%D8%A7%D9%84%D8%A7%D8%AA-%D8%A5%D9%86%D8%B3%D8%A7%D9%86%D9%8A%D8%A9/c910263623", launchCampaign: "https://masarcharity.com/%D8%AD%D8%A7%D9%84%D8%A7%D8%AA-%D8%A5%D9%86%D8%B3%D8%A7%D9%86%D9%8A%D8%A9/c910263623", donationOpportunities: "https://masarcharity.com/%D8%AD%D8%A7%D9%84%D8%A7%D8%AA-%D8%A5%D9%86%D8%B3%D8%A7%D9%86%D9%8A%D8%A9/c910263623" }; const sidebarHTML = `
🤲التبرع السريع 🎁إهداء التبرع 🚀أطلق حملتك 💳فرص التبرع
`; const css = ` :root { --accent: #0d6efd; --bg: #fff; --shadow: 0 8px 26px rgba(6,24,44,0.12); --radius: 14px; --font: "Almarai", sans-serif; } .floating-sidebar { position: fixed; top: 30%; right: 14px; background: var(--bg); border-radius: var(--radius); padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: var(--shadow); z-index: 9999; transition: .36s; font-family: var(--font); } .floating-sidebar.closed { transform: translateX(calc(100% + 20px)); opacity: 0; } .toggle-btn { position: absolute; top: -14px; left: -36px; background: var(--accent); color: #fff; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; } .sidebar-item { text-decoration: none; color: #16324a; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; } .sidebar-item:hover { color: var(--accent); transform: translateX(-6px); } .icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(13,110,253,0.06), rgba(13,110,253,0.01)); font-size: 20px; } .label { font-size: 12px; } /* قسم المشاريع */ .projects-section { padding: 80px 20px 40px; background: #f8fbff; text-align: center; font-family: var(--font); } .projects-section h2 { font-size: 32px; color: #0d2152; margin-bottom: 40px; font-weight: 800; } .projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; max-width: 1100px; margin: auto; } .project-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); overflow: hidden; transition: transform 0.3s ease; } .project-card:hover { transform: translateY(-6px); } .project-card img { width: 100%; height: 180px; object-fit: cover; } .project-card h3 { color: #0d2152; font-size: 18px; margin: 10px 0; } .project-card p { color: #555; font-size: 14px; padding: 0 12px; min-height: 50px; } .progress-container { width: 90%; height: 10px; background: #eee; border-radius: 5px; margin: 10px auto; overflow: hidden; } .progress-bar { height: 100%; background: linear-gradient(90deg, #0d6efd, #0b5ed7); border-radius: 5px; } .progress-info { display: flex; justify-content: space-between; padding: 0 20px; font-size: 13px; color: #0d2152; } .share-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 15px 0; } .share-options button { background: #eaf0ff; border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; color: #0d2152; font-weight: 600; } .share-options button:hover { background: #d0e0ff; } .donate-footer { display: flex; justify-content: center; gap: 8px; padding: 15px 0 20px; } .donate-footer input { width: 80px; border: 1px solid #ccc; border-radius: 8px; padding: 6px; text-align: center; } .donate-btn { background: #0d6efd; color: #fff; border: none; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-weight: 700; } .donate-btn:hover { background: #0b5ed7; } /* قسم الإحصائيات */ .stats-section { text-align: center; padding: 60px 20px; background: #fff; font-family: var(--font); } .stats-title { font-size: 28px; color: #0d2152; margin-bottom: 40px; font-weight: 800; } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; max-width: 900px; margin: auto; } .stat-card { background: #fff; border-radius: 16px; padding: 25px 15px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); transition: transform 0.3s ease; } .stat-card:hover { transform: translateY(-5px); } .stat-icon { font-size: 30px; color: #0d6efd; margin-bottom: 10px; } .stat-number { font-size: 26px; font-weight: 800; color: #0d2152; margin-bottom: 5px; } .stat-card p { margin: 0; font-size: 14px; color: #333; } `; const styleTag = document.createElement("style"); styleTag.textContent = css; document.head.appendChild(styleTag); document.body.insertAdjacentHTML("beforeend", sidebarHTML); const sidebar = document.getElementById("floatingSidebar"); const toggle = document.getElementById("sidebarToggle"); toggle.addEventListener("click", function () { sidebar.classList.toggle("closed"); toggle.textContent = sidebar.classList.contains("closed") ? "☰" : "✖"; }); } /* =============================== 📁 قسم "من مشاريع الجمعية" =============================== */ const projectsHTML = `

من مشاريع الجمعية

مشروع

حالة إنسانية رقم 269

رجل متقاعد من ذوي الدخل المحدود يعاني من إصابة في القدم ويحتاج لكرسي متحرك.

المتبقي: 4693 ريالالمكتمل: 15341 ريال
مشروع

حالة إنسانية رقم 270

امرأة تعاني من ضعف في التنفس وتحتاج إلى جهاز أكسجين منزلي بشكل عاجل.

المتبقي: 10379 ريالالمكتمل: 130 ريال
مشروع

حالة إنسانية رقم 272

طفل بحاجة إلى عملية زرع قوقعة ليستعيد السمع والتفاعل مع من حوله.

المتبقي: 8423 ريالالمكتمل: 30 ريال
`; /* =============================== 📊 قسم الإحصائيات فوق الفوتر =============================== */ const statsHTML = `

الإحصائيات

👥
0

المستفيدين

🌀
0

المبادرات الاجتماعية

🎓
0

الشراكات الاجتماعية

🙌
0

الساعات التطوعية

`; const footer = document.querySelector("footer"); if (footer) { footer.insertAdjacentHTML("beforebegin", statsHTML); footer.insertAdjacentHTML("beforebegin", projectsHTML); } // عداد الإحصائيات المتحرك const counters = document.querySelectorAll(".stat-number"); const speed = 100; const startCounting = (entry) => { if (entry.isIntersecting) { counters.forEach(counter => { const updateCount = () => { const target = +counter.getAttribute("data-target"); const count = +counter.innerText; const increment = target / speed; if (count < target) { counter.innerText = Math.ceil(count + increment); setTimeout(updateCount, 30); } else { counter.innerText = target.toLocaleString(); } }; updateCount(); }); } }; const observer = new IntersectionObserver((entries) => { entries.forEach(startCounting); }, { threshold: 0.5 }); counters.forEach(counter => observer.observe(counter)); });