// if(window.location.href.search("c834186269")>0){ // const theEl = document.querySelector('.products-index.mb-10> div.container') // const bannar = document.createElement('div') // const html = `` // bannar.classList.add('order-1','w-100') // theEl.classList.add('flex','flex-col-reverse') // bannar.innerHTML=html // theEl.appendChild(bannar) // console.log(theEl) // } // const firstHeader = document.querySelector('h1, h2, h3, h4, h5, h6'); // if (firstHeader && firstHeader.tagName.toLowerCase() === 'h2') { // // إنشاء عنصر H1 جديد // const newH1 = document.createElement('h1'); // newH1.innerHTML = firstHeader.innerHTML; // نسخ المحتوى // // استبدال h2 بـ h1 // firstHeader.parentNode.replaceChild(newH1, firstHeader); // console.log('تم تحويل أول H2 إلى H1'); // } else { // console.log('أول عنصر ليس H2، لم يتم التغيير'); // } // // اختار أول عنصر h1 // let oldHeading = document.querySelectorAll('h1')[0]; // // أنشئ عنصر h2 جديد // let newHeading = document.createElement('h2'); // // انسخ المحتوى من h1 إلى h2 // newHeading.innerHTML = oldHeading.innerHTML; // // استبدل h1 بـ h2 في الـ DOM // oldHeading.parentNode.replaceChild(newHeading, oldHeading); // let headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); // for (let i = 0; i < headings.length; i++) { // if (headings[i].tagName === 'H1') { // // أول عنصر h1 ظهر، نوقف الحذف // break; // } else { // // امسح العنوان من الصفحة // console.log(headings) // headings[i].remove(); // } // } // // 1- الحصول على اسم التصنيف من الـ breadcrumbs // let breadcrumbCategories = document.querySelectorAll('.breadcrumbs ol li a'); // let categoryName = null; // if (breadcrumbCategories.length > 1) { // // آخر رابط في الـ breadcrumbs عادة هو التصنيف (قبل المنتج) // categoryName = breadcrumbCategories[breadcrumbCategories.length - 1].textContent.trim(); // } else { // console.error("ما فيش تصنيف في الـ breadcrumbs"); // } // // 2- البحث عن التصنيف في المنيو الأولى وجلب الـ ID // if (categoryName) { // let menuItems = document.querySelectorAll('#mobile-menu li, nav.mobile-menu li'); // let foundId = null; // menuItems.forEach(item => { // let span = item.querySelector('span'); // if (span && span.textContent.trim() === categoryName) { // foundId = item.getAttribute('id'); // } // }); // // 3- لو لقينا الـ ID، نحقن الكود في المكان المطلوب // if (foundId) { // document.querySelector('.app-inner.flex.flex-col.min-h-full.bg-storeBG .container.mt-5').innerHTML = ` // // `; // } else { // console.log("ما لقيتش التصنيف في المنيو"); // } // }