document.addEventListener("DOMContentLoaded", function () { function isCategoryPage() { // التحقق من وجود "/c" في نهاية الرابط، مثل: /إنارة/c123456 return /\/c\d+/.test(window.location.pathname); } function removeCanonicalLinks() { const canonicals = document.querySelectorAll('link[rel="canonical"]'); canonicals.forEach(link => { // إذا كان الرابط يشير لصفحة تصنيف، احذفه if (/\/c\d+/.test(link.href)) { link.remove(); console.log("✔️ تم إزالة canonical من صفحة التصنيف:", link.href); } }); } if (isCategoryPage()) { // التأخير للتأكد من تحميل السكربتات مثل GTM setTimeout(removeCanonicalLinks, 1000); } }); //move butt document.addEventListener('DOMContentLoaded', function () { function moveButtonOnly() { const priceElement = document.querySelector('.bg-storeBG.p-5.rounded-md.rounded-b-none.flex.sm\\:pb-0.product-price.product-price-bottom'); const button = document.querySelector('button.mt-5.w-full.sticky-product-bar__btn.s-add-product-button-with-quick-buy.hydrated.s-button-element.s-button-btn.s-button-solid.s-button-primary.s-button-loader-after'); if (priceElement && button) { // نقل الزر بعد السعر priceElement.insertAdjacentElement('afterend', button); // إعادة تفعيل الرابط (واتساب) const whatsappUrl = button.getAttribute('href') || "https://elburoj.com/ar/whatsapp/send"; button.removeAttribute('href'); button.replaceWith(button.cloneNode(true)); const newButton = document.querySelector('button.mt-5.w-full.sticky-product-bar__btn.s-add-product-button-with-quick-buy.hydrated.s-button-element.s-button-btn.s-button-solid.s-button-primary.s-button-loader-after'); newButton.addEventListener('click', function () { window.location.href = whatsappUrl; }); clearInterval(intervalId); } } let attempts = 0; const maxAttempts = 20; const intervalId = setInterval(function () { attempts++; moveButtonOnly(); if (attempts >= maxAttempts) clearInterval(intervalId); }, 500); }); //mini document.addEventListener("DOMContentLoaded", function () { function minifyHTML(str) { return str .replace(/\n/g, "") // إزالة الأسطر .replace(/\s{2,}/g, " ") // ضغط المسافات .replace(/>\s+<") // إزالة الفراغات بين التاجات .trim(); } function minifyCSS(css) { return css .replace(/\s{2,}/g, " ") .replace(/\s*([:;{},])\s*/g, "$1") .replace(/;}/g, "}") .replace(/\n/g, "") .trim(); } // ضغط كل عناصر