document.addEventListener('DOMContentLoaded', function() { let logo = document.querySelector('.navbar-brand'); let footerBox = document.querySelector('footer > div.store-footer__inner > div > div.lg\\:col-span-2.rtl\\:lg\\:pl-20.ltr\\:lg\\:pr-20 a.flex.items-center.m-0'); if (logo && footerBox) { // تصغير h3 let h3 = footerBox.querySelector('a > h3'); if (h3) h3.style.fontSize = '0'; // نسخ الشعار let clone = logo.cloneNode(true); footerBox.appendChild(clone); } console.log(logo); console.log(footerBox); }); document.querySelector("body > div.app-inner.flex.flex-col.min-h-full > header > div.main-nav-container.shadow-default.bg-white > div > div > div .flex.items-center.justify-end").innerHTML+= ` `; window.Salla.onReady(function() { console.log('Salla Ready - Attempting to move main menu...'); // انتظر قليلاً للتأكد من تحميل جميع المكونات الداخلية setTimeout(function() { // ابحث عن عنصر القائمة الرئيسية const customMainMenuElement = document.querySelector('custom-main-menu'); if (!customMainMenuElement) { console.error('Salla Helper: Custom main menu element not found.'); return; } // ابحث عن الهيدر. const storeHeader = document.querySelector('header.store-header'); if (!storeHeader) { console.error('Salla Helper: Store header element not found.'); return; } // ابحث عن العنصر الذي يأتي بعد الهيدر مباشرة. // سنستخدم الهيدر نفسه كمرجع لوضع القائمة بعده. const elementAfterHeader = storeHeader; // الهيدر نفسه هو العنصر الذي سنضيف القائمة بعده // نحصل على الأخ الذي يلي الهيدر مباشرة في شجرة DOM const nextSiblingElement = elementAfterHeader.nextElementSibling; console.log('Found customMainMenuElement:', customMainMenuElement); console.log('Found storeHeader:', storeHeader); console.log('Found nextSiblingElement (placeholder for insertion):', nextSiblingElement); // قم بإزالة العنصر من موقعه الأصلي (داخل الهيدر) if (customMainMenuElement && customMainMenuElement.parentNode) { customMainMenuElement.remove(); console.log('Custom main menu element removed from its original position.'); } else { console.error('Custom main menu element not found in DOM to remove.'); return; } // قم بإدراج العنصر الجديد في المكان المحدد if (nextSiblingElement) { // أدخل العنصر الجديد قبل العنصر التالي للهيدر // نستخدم parentNode للهيدر لوضع العنصر الجديد فيه، قبل العنصر التالي storeHeader.parentNode.insertBefore(customMainMenuElement, nextSiblingElement); console.log('Custom main menu inserted before the next sibling element.'); } else { // إذا لم يكن هناك عنصر تالي للهيدر، أضفه بعد الهيدر مباشرة في نفس المستوى storeHeader.parentNode.appendChild(customMainMenuElement); console.log('Custom main menu appended after the header element.'); } console.log('Salla Helper: Custom main menu moved successfully.'); // في حال واجهت مشاكل مع فتح القائمة للجوال بعد النقل، قد تحتاج إلى إعادة تهيئة // السكريبتات المسؤولة عن ذلك. مثلاً، إذا كانت هناك دالة تهيئة اسمها SallaMobileMenu.init(): // if (typeof SallaMobileMenu !== 'undefined' && SallaMobileMenu.init) { // SallaMobileMenu.init(); // } }, 500); // تأخير لضمان تحميل المكونات }); document.addEventListener("DOMContentLoaded", function() { const header = document.querySelector("body.index header.store-header"); if (header) { const wrapper = document.createElement("div"); wrapper.classList.add("video-wrapper"); const video = document.createElement("video"); video.classList.add("custom-video"); video.src = "https://raw.githack.com/elwa2/Videos/main/IMG_5376.mp4"; video.autoplay = true; video.loop = true; video.muted = true; video.playsInline = true; wrapper.appendChild(video); header.parentNode.insertBefore(wrapper, header.nextSibling); } }); (function() { let attempts = 0; const maxAttempts = 10; /** * دالة لاستخراج اسم المتجر من عنوان الصفحة * المثال: "التخفيضات - tidy brand" -> تأخذ "tidy brand" */ function getStoreName() { try { let fullTitle = document.title; // جلب العنوان كامل من المتصفح if (fullTitle.includes('-')) { // إذا كان العنوان يحتوي على شرطة، نقسمه ونأخذ الجزء الأخير let parts = fullTitle.split('-'); return parts[parts.length - 1].trim(); } return fullTitle; // إذا لم توجد شرطة، نأخذ العنوان كما هو } catch (e) { return "المتجر"; // اسم احتياطي في حال حدوث خطأ } } /** * البحث عن رقم الواتساب من فوتر الموقع (خاص بمنصة سلة) */ function findNumberAndInit() { const footerWaLink = document.querySelector('footer.store-footer a[href*="wa.me"]'); if (footerWaLink) { let href = footerWaLink.getAttribute('href'); let extractedNumber = href.split('wa.me/')[1].split('?')[0]; buildWhatsappButton(extractedNumber); } else if (attempts < maxAttempts) { attempts++; setTimeout(findNumberAndInit, 500); } else { // الرقم الافتراضي في حال لم يتم العثور على رقم في الموقع buildWhatsappButton("966539170830"); } } /** * بناء وتصميم زر الواتساب العائم */ function buildWhatsappButton(whatsappNumber) { if (document.querySelector('.salla-whatsapp-floating')) return; // إضافة التنسيقات (CSS) للزر const style = document.createElement('style'); style.innerHTML = ` .salla-whatsapp-floating { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background-color: #25d366; color: #fff; border-radius: 50%; text-align: center; font-size: 30px; box-shadow: 2px 2px 15px rgba(0,0,0,0.2); z-index: 999999; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; text-decoration: none !important; cursor: pointer; } .salla-whatsapp-floating:hover { background-color: #128c7e; transform: scale(1.1); } /* تأثير النبض خلف الزر */ .salla-whatsapp-floating::after { content: ""; position: absolute; width: 100%; height: 100%; background-color: #25d366; border-radius: 50%; z-index: -1; animation: pulse-whatsapp 2s infinite; } @keyframes pulse-whatsapp { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.6); opacity: 0; } } .salla-whatsapp-floating svg { width: 35px; height: 35px; fill: #fff; } @media (max-width: 768px) { .salla-whatsapp-floating { bottom: 20px; right: 20px; width: 55px; height: 55px; } } `; document.head.appendChild(style); // إنشاء عنصر الرابط (Link) للزر const waLink = document.createElement('a'); waLink.className = 'salla-whatsapp-floating'; waLink.setAttribute('aria-label', 'تواصل معنا عبر واتساب'); waLink.innerHTML = ` <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/> </svg> `; /** * وظيفة النقر على الزر وتجهيز الرسالة */ waLink.addEventListener('click', function(e) { e.preventDefault(); // الحصول على اسم المتجر من الـ Title const storeName = getStoreName(); // الرسالة الافتراضية let message = `السلام عليكم، أرغب في الاستفسار عن منتجات ${storeName}`; const currentUrl = window.location.href; // محاولة جلب اسم المنتج إذا كان العميل في صفحة منتج const productTitleElement = document.querySelector('h1.text-xl, h1.t-title, .main-content h1'); if (currentUrl.includes('/p') && productTitleElement) { let productName = productTitleElement.innerText.trim(); message = `السلام عليكم، أرغب في الاستفسار عن هذا المنتج من ${storeName}:\n\n*المنتج:* ${productName}\n*الرابط:* ${currentUrl}`; } // فتح الواتساب في نافذة جديدة const finalWaUrl = `https://wa.me/${whatsappNumber}?text=${encodeURIComponent(message)}`; window.open(finalWaUrl, '_blank'); }); document.body.appendChild(waLink); console.log("WhatsApp Button Loaded for Store: " + getStoreName()); } // بدء التشغيل عند اكتمال تحميل الصفحة if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', findNumberAndInit); } else { findNumberAndInit(); } })(); document.addEventListener("DOMContentLoaded",(function(){function e(){var e=document.querySelector("salla-trust-badges.s-trust-badges-wrapper");return!!e&&(e.remove(),!0)}if(!e()){var t=setInterval((function(){e()&&clearInterval(t)}),500);setTimeout((function(){clearInterval(t)}),1e4)}}));