/* ========================================================= TARAF STORE - CUSTOM JAVASCRIPT ========================================================= */ /* ========================================================= AL ZAIEM - Footer Link ========================================================= */ document.addEventListener("DOMContentLoaded", function () { const footer = document.querySelector(".store-footer"); if (!footer) return; const container = document.createElement("div"); container.className = "alzaiem-copy-rights"; const link = document.createElement("a"); link.href = "https://api.whatsapp.com/send/?phone=966562848137&text&type=phone_number&app_absent=0"; link.target = "_blank"; link.className = "alzaiem-footer-link"; link.textContent = "برمجة وتطوير alzaiem1.com"; container.appendChild(link); footer.appendChild(container); }); /* ========================================================= AL ZAIEM - Copyright ========================================================= */ document.addEventListener("DOMContentLoaded", function () { const copyrightSpan = document.querySelector("span.copyright-text"); if (copyrightSpan) { copyrightSpan.innerHTML = ` برمجة وتطوير 2025 |   AL Zaiem 💻 `; } else { console.error( "Copyright element (span.copyright-text) not found." ); } }); /* ========================================================= TARAF - ضبط مقاس البانر الرئيسي إظهار الصورة والشعار كاملين ========================================================= */ (function () { function fixTarafHeroSlider() { const slider = document.querySelector( "salla-slider#main-slider-1" ); if (!slider) return; const slides = slider.querySelectorAll( ".swiper-slide" ); if (!slides.length) return; slides.forEach(function (slide) { /* --------------------------------------------- منع قص صورة البانر --------------------------------------------- */ const imageLayer = slide.querySelector(".bg-cover"); if (imageLayer) { imageLayer.style.setProperty( "background-size", "100% 100%", "important" ); imageLayer.style.setProperty( "background-position", "center center", "important" ); imageLayer.style.setProperty( "background-repeat", "no-repeat", "important" ); } /* --------------------------------------------- قراءة رابط الصورة وحساب الارتفاع المناسب --------------------------------------------- */ const imageUrl = imageLayer ? imageLayer.style.backgroundImage : ""; if (imageUrl) { const match = imageUrl.match( /url\(["']?(.*?)["']?\)/ ); if (match && match[1]) { const img = new Image(); img.onload = function () { const ratio = img.naturalHeight / img.naturalWidth; const sliderWidth = slider.getBoundingClientRect().width; if (!sliderWidth) return; const newHeight = sliderWidth * ratio; const finalHeight = Math.max( newHeight, 300 ); slide.style.setProperty( "height", finalHeight + "px", "important" ); slide.style.setProperty( "min-height", finalHeight + "px", "important" ); }; img.src = match[1]; } } }); } /* ===================================================== تشغيل أولي ===================================================== */ if ( document.readyState === "loading" ) { document.addEventListener( "DOMContentLoaded", fixTarafHeroSlider ); } else { fixTarafHeroSlider(); } /* ===================================================== بعد تحميل الصور ===================================================== */ window.addEventListener( "load", fixTarafHeroSlider ); /* ===================================================== مراقبة تغييرات سلة ===================================================== */ const observer = new MutationObserver(function () { fixTarafHeroSlider(); }); observer.observe( document.body, { childList: true, subtree: true } ); /* ===================================================== إعادة الضبط عند تغيير حجم الشاشة ===================================================== */ let resizeTimer; window.addEventListener( "resize", function () { clearTimeout( resizeTimer ); resizeTimer = setTimeout( fixTarafHeroSlider, 250 ); } ); })(); /* ========================================================= TARAF - صور أقسام القائمة كاملة ========================================================= */ (function () { function fixMenuCategoryImages() { const images = document.querySelectorAll( "#mobile-menu img.rounded-full, .mm-spn img.rounded-full" ); images.forEach(function (img) { /* --------------------------------------------- الحجم --------------------------------------------- */ img.style.setProperty( "width", "48px", "important" ); img.style.setProperty( "height", "48px", "important" ); img.style.setProperty( "min-width", "48px", "important" ); img.style.setProperty( "min-height", "48px", "important" ); /* --------------------------------------------- الصورة كاملة بدون قص --------------------------------------------- */ img.style.setProperty( "object-fit", "contain", "important" ); img.style.setProperty( "object-position", "center", "important" ); /* --------------------------------------------- خلفية الصورة --------------------------------------------- */ img.style.setProperty( "background-color", "#F7F1E5", "important" ); /* --------------------------------------------- الشكل الدائري --------------------------------------------- */ img.style.setProperty( "border-radius", "50%", "important" ); /* --------------------------------------------- منع القص --------------------------------------------- */ img.style.setProperty( "overflow", "hidden", "important" ); }); } /* ===================================================== تشغيل مباشر ===================================================== */ if ( document.readyState === "loading" ) { document.addEventListener( "DOMContentLoaded", fixMenuCategoryImages ); } else { fixMenuCategoryImages(); } /* ===================================================== مراقبة القائمة ===================================================== */ const observer = new MutationObserver(function () { fixMenuCategoryImages(); }); observer.observe( document.body, { childList: true, subtree: true } ); /* ===================================================== إعادة التطبيق بعد تحميل سلة ===================================================== */ setTimeout( fixMenuCategoryImages, 300 ); setTimeout( fixMenuCategoryImages, 1000 ); setTimeout( fixMenuCategoryImages, 2500 ); })();