/* Add custom Js code below */
// Define an array of external links
const links = [
"https://moments-kids-studio.com/%D8%A8%D8%A7%D9%82%D8%A7%D8%AA-%D8%AA%D8%B5%D9%88%D9%8A%D8%B1-%D8%A7%D9%84%D8%A7%D8%B7%D9%81%D8%A7%D9%84/c542791341",
"https://moments-kids-studio.com/%D8%A8%D8%A7%D9%82%D8%A7%D8%AA-%D8%AA%D8%B5%D9%88%D9%8A%D8%B1-%D8%A7%D9%84%D8%A7%D8%B7%D9%81%D8%A7%D9%84/c542791341",
"https://maps.app.goo.gl/PLZndjp291vGveKC6?g_st=iw",
"https://api.whatsapp.com/send/?phone=966538553874&text&type=phone_number&app_absent=0",
];
// Select all rectangle containers
const rectangles = document.querySelectorAll(".s-block--features__item");
// Loop through each rectangle and assign the corresponding link
rectangles.forEach((rectangle, index) => {
if (links[index]) {
// Add an event listener for navigation
rectangle.addEventListener("click", () => {
window.open(links[index], "_blank");
});
// Optionally, change the cursor to indicate it's clickable
rectangle.style.cursor = "pointer";
}
});
function setRedirect(id, url) {
const element = document.querySelector(`#${id} .square-photos-item`);
if (element) {
element.addEventListener("click", () => {
window.location.href = url;
});
}
}
// قسم 3 بدون رابط
setRedirect("square-photos-3", "https://moments-kids-studio.com/search?q=birthday");
// قسم 4 يأخذ رابط القسم 5
setRedirect("square-photos-4", "https://moments-kids-studio.com/%D8%AA%D8%B5%D9%88%D9%8A%D8%B1-%D8%A7%D9%84%D8%A7%D8%B7%D9%81%D8%A7%D9%84/c542791341");
document.addEventListener("DOMContentLoaded", function () {
if (!location.pathname.includes("page-1927521401")) return;
// أولًا: أضف CSS إلى
const style = document.createElement("style");
style.textContent = `
.manual-product-card {
width: 180px;
flex: 0 0 auto;
border: 1px solid #e0e0e0;
border-radius: 12px;
overflow: hidden;
background: white;
box-shadow: 0 2px 4px rgba(0,0,0,0.06);
font-family: inherit;
transition: transform 0.2s ease;
}
.manual-product-card:hover {
transform: translateY(-4px);
}
.manual-product-card img {
width: 100%;
height: 160px;
object-fit: cover;
border-radius: 0;
}
.manual-product-card h3 {
font-size: 15px;
margin: 8px 0 4px;
color: #111;
}
.manual-product-card p {
font-size: 13px;
color: #666;
margin: 0;
}
.manual-product-card a.button {
display: inline-block;
margin: 10px auto 12px;
background-color: #cea3de !important;
color: white;
padding: 6px 14px;
border-radius: 6px;
text-decoration: none;
font-size: 13px;
}
.manual-product-card .price {
font-size: 14px;
font-weight: bold;
color: #000;
margin-top: 6px;
}
.manual-slider {
display: flex;
gap: 1rem;
overflow-x: auto;
padding: 1rem 0;
}
`;
document.head.appendChild(style);
// ثانيًا: HTML للسلايدر اليدوي
const sectionHTML = `
`;
const footer = document.querySelector("footer");
if (footer) {
footer.insertAdjacentHTML("beforebegin", sectionHTML);
}
});
document.addEventListener("DOMContentLoaded", function () {
if (!location.pathname.includes("page-1927521401")) return;
// CSS styles for the button
const style = document.createElement("style");
style.textContent = `
.homepage-button-container {
padding: 20px;
margin-top: 20px;
text-align: center;
}
.homepage-button {
display: inline-block;
width: 100%;
max-width: 400px;
background-color: #cea3de;
color: white;
padding: 14px 0;
border-radius: 8px;
text-decoration: none;
font-size: 18px;
font-weight: bold;
}
`;
document.head.appendChild(style);
// HTML for the button section
const buttonHTML = `
`;
// Insert just before the footer (like your working section)
const footer = document.querySelector("footer");
if (footer) {
footer.insertAdjacentHTML("beforebegin", buttonHTML);
}
});
document.addEventListener("DOMContentLoaded", function () {
// ✅ تحقق من أن رابط الصفحة يحتوي على رقم المنتج المطلوب
if (!location.pathname.includes("2112872326")) return;
// ✅ فتح الأكورديون تلقائيًا
const accordionPanel = document.querySelector("#accordionOptions");
if (accordionPanel) {
accordionPanel.classList.add("is-opened");
accordionPanel.style.display = "block";
}
// ✅ نقل div إلى داخل .main-content-data
const targetDiv = document.querySelector(".main-content-data");
const divToMove = document.querySelector(".grow.sm\\:grow-0.w-full");
if (targetDiv && divToMove) {
targetDiv.appendChild(divToMove);
}
});
document.addEventListener("DOMContentLoaded", function () {
// ✅ تحقق من أن الصفحة هي صفحة المنتج المطلوب
if (!location.pathname.includes("2112872326")) return;
// ✅ فتح الأكورديون تلقائيًا
const accordionPanel = document.querySelector("#accordionOptions");
if (accordionPanel) {
accordionPanel.classList.add("is-opened");
accordionPanel.style.display = "block";
}
// ✅ ضبط العنصر الذي يحتوي زر "احجز الآن" في مكانه الأصلي
const buttonWrapper = document.querySelector('div.grow.sm\\:grow-0.w-full');
if (buttonWrapper) {
// مثال: تضيف كلاس خاص للتعديل عليه من CSS
buttonWrapper.classList.add("custom-order-style");
// أو تقدر تضيف تنسيق مباشرة:
// buttonWrapper.style.border = "2px dashed red";
}
});
(function() {
const button = document.createElement('a');
button.href = 'http://wa.me/966538553874'; // Replace with your WhatsApp number
button.target = '_blank';
button.style.position = 'fixed';
button.style.bottom = '80px';
button.style.right = '20px';
button.style.zIndex = '9999';
button.style.backgroundColor = '#25d366';
button.style.padding = '10px';
button.style.borderRadius = '50%';
button.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.2)';
const icon = document.createElement('img');
icon.src = 'https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg';
icon.alt = 'WhatsApp';
icon.style.width = '50px';
icon.style.height = '50px';
button.appendChild(icon);
document.body.appendChild(button);
})();
document.addEventListener("DOMContentLoaded", function() {
// لو الصفحة فيها أحد الاستثناءات لا نعمل شي
if (document.querySelector("#details-slider-434980582") ||
document.querySelector("#product-2112872326")) {
return;
}
const originalBtn = document.querySelector("#add-to-cart-btn");
if (!originalBtn) return;
// اخفي الزر الاصلي
originalBtn.style.display = "none";
// انشاء زر جديد
const stickyBtn = document.createElement("button");
stickyBtn.id = "sticky-booking-btn";
stickyBtn.innerText = "إحجـز الآن";
// استايل مبسط للزر
stickyBtn.style.cssText = `
position:fixed;bottom:0;left:0;width:100%;
background:#e3b5f5;color:#fff;font-size:24px;
padding:18px;border:none;z-index:9999;cursor:pointer;
`;
// عند الضغط يشغل الزر الاصلي
stickyBtn.onclick = function() {
const old = originalBtn.querySelector("button");
if (old) old.click();
};
document.body.appendChild(stickyBtn);
});
setInterval(()=>{
document.querySelectorAll('custom-salla-product-card[product*="2112872326"]')
.forEach(el => el.closest('.swiper-slide')?.remove());
},500);