/* Add custom JS code below */ // 2. كود إضافة أيقونات التواصل الاجتماعي window.addEventListener('load', function() { // شرط الحماية: إذا كنا داخل لوحة التحكم، لا تقم بتشغيل الكود if (window.location.href.includes('/admin') || window.location.href.includes('dashboard')) { return; } const contactList = document.querySelector('.floating-contact-list'); if (contactList && !document.querySelector('.custom-social-added')) { const newSocials = [ { href: 'https://www.instagram.com/zahrat_hal', icon: 'sicon-instagram', title: 'إنستقرام' }, { href: 'https://www.tiktok.com/@zahrat0880', icon: 'sicon-tiktok', title: 'تيك توك' } ]; newSocials.forEach(social => { const li = document.createElement('li'); li.classList.add('custom-social-added'); li.innerHTML = ` ${social.title} `; contactList.appendChild(li); }); } }); document.addEventListener('DOMContentLoaded', function() { // منع تكرار التنفيذ if (document.querySelector('.custom-footer-main-row')) return; const sections = [ { target: '.contacts-list', title: 'تواصل معنا' }, { target: '.footer-menu-list', title: 'روابط هامة' }, { target: '.footer-social-section', title: 'حساباتنا' } ]; // 1. البحث عن أول قسم متوفر لنستخدمه كنقطة ارتكاز (بدون الاعتماد على حاويات سلة) let firstSectionEl = null; for (let sec of sections) { let el = document.querySelector(sec.target); if (el) { firstSectionEl = el; break; } } if (!firstSectionEl) return; // إذا لم يجد أي قسم، سيتم الإلغاء لعدم إخفاء العناصر // 2. إنشاء الصف الرئيسي let mainRow = document.createElement('div'); mainRow.className = 'custom-footer-main-row'; // إدراج الصف الرئيسي قبل أول قسم موجود firstSectionEl.parentNode.insertBefore(mainRow, firstSectionEl); // 3. سحب الأقسام ووضعها داخل الصف الجديد بشكل مرتب sections.forEach(sec => { let contentDiv = document.querySelector(sec.target); if (contentDiv) { let col = document.createElement('div'); col.className = 'custom-footer-col'; let header = document.createElement('div'); header.className = 'custom-footer-header'; header.innerHTML = `${sec.title}`; col.appendChild(header); col.appendChild(contentDiv); mainRow.appendChild(col); // تشغيل حركة الأكورديون للجوال header.addEventListener('click', function() { if (window.innerWidth <= 767) { this.classList.toggle('active'); contentDiv.classList.toggle('open-in-mobile'); } }); } }); });