// أولاً قسم أبعاد المنتج
document.addEventListener("DOMContentLoaded", function () {
const banner = document.querySelector(".index .store-header");
if (banner) {
const container = document.createElement("div");
container.className = "video-banner-container";
const video = document.createElement("video");
video.src = "https://res.cloudinary.com/dggfjzsnr/video/upload/v1754544564/OMHU_TEDDY_Sofa_3D_Rendering_ugasck.mp4";
video.autoplay = true;
video.loop = true;
video.muted = true;
video.playsInline = true;
video.style.width = "100%";
video.style.display = "block";
const overlay = document.createElement("div");
overlay.className = "video-overlay";
overlay.innerHTML = `
Modz – أكثر من كنبة
هي زاويتك المفضلة، مكان قهوتك الصباحية، وسريرك المريح آخر الليل… وكل شيء بينهما.
تصميم بسيط يخطف العين، وجودة ما تعرف التنازل. خامة مخملية ناعمة تجيك بألوان تعكس شخصيتك: الأخضر المنعش، الأزرق الهادئ، الرمادي الكلاسيكي، و غيرها كثير.
وتكتمل الحكاية بلمسة أنيقة من قضبان معدنية تضيف لمسة فخامة خفيفة… لأن التفاصيل الصغيرة تصنع الفرق
استمتع بتجربة فريدة من نوعها، واكتشف لتناسب ذوقك.
`;
banner.appendChild(section); // نضيف السكشن بعد الفيديو داخل .pair-grid
}
});
window.addEventListener('load', () => {
document.body.classList.add('loaded');
});
document.addEventListener('DOMContentLoaded', function () {
const dimensionsSection = `
مقاسات الأريكة
الحجم الكلي:
العرض 200 سم، العمق 100 سم، الارتفاع 70 سم
`;
const commentsSection = document.querySelector('.product-single salla-comments');
if (commentsSection) {
const wrapper = document.createElement('div');
wrapper.innerHTML = dimensionsSection;
commentsSection.parentNode.insertBefore(wrapper, commentsSection);
}
// ✅ سلايدر صور واستخدامات الكنبة
const sliderData = [
{
image: '//omhucph.com/cdn/shop/files/Omhu126002_CREAM-WHITE---5769_2_fritlagt_til-pdp.png?v=1736759341&width=800',
caption: 'The Modz can be turned into a bed in a matter of seconds',
thumb: '//omhucph.com/cdn/shop/files/image-1.png?v=1735802235&width=104'
},
{
image: '//omhucph.com/cdn/shop/files/Omhu126003_CREAM-WHITE---5769_2_fritlagt_til-pdp.png?v=1736759341&width=800',
caption: 'The Modz can be turned into a conversation pit',
thumb: '//omhucph.com/cdn/shop/files/image-2.png?v=1735802235&width=104'
},
{
image: '//omhucph.com/cdn/shop/files/Omhu125998_CREAM-WHITE---5769__2_fritlagt_til-pdp.png?v=1736759341&width=800',
caption: 'The Modz can function as a normal sofa',
thumb: '//omhucph.com/cdn/shop/files/image-3.png?v=1735802235&width=104'
}
];
const section = document.createElement("div");
section.className = "dimensions-section";
section.style = "padding: 1rem 0; ";
const container = document.createElement("div");
container.className = "dimensions-slider";
container.style = "text-align:center; max-width:800px; margin:0 auto;";
const image = document.createElement("img");
image.src = sliderData[0].image;
image.style = "max-width:100%; margin-bottom:1rem;";
const caption = document.createElement("p");
caption.textContent = sliderData[0].caption;
const dotsContainer = document.createElement("div");
dotsContainer.className = "dimensions-dots";
dotsContainer.style = "display:flex; justify-content:center; gap:10px; margin-top:1rem;";
sliderData.forEach((slide, index) => {
const dot = document.createElement("div");
dot.className = "dimensions-dot" + (index === 0 ? " selected" : "");
dot.style = "width:64px; height:64px; border-radius:8px; overflow:hidden; border:2px solid " + (index === 0 ? "black" : "transparent") + "; cursor:pointer;";
const dotImg = document.createElement("img");
dotImg.src = slide.thumb;
dotImg.style = "width:100%; height:100%; object-fit:cover;";
dot.appendChild(dotImg);
dot.addEventListener("click", () => {
image.src = slide.image;
caption.textContent = slide.caption;
document.querySelectorAll(".dimensions-dot").forEach(el => {
el.style.borderColor = "transparent";
});
dot.style.borderColor = "black";
});
dotsContainer.appendChild(dot);
});
container.appendChild(image);
container.appendChild(caption);
container.appendChild(dotsContainer);
section.appendChild(container);
const target = document.querySelector('.product-single .product-dimensions');
if (target) {
target.insertAdjacentElement('beforebegin', section);
}
// ✅ Grid يحتوي على صور وفيديوهات مزدوجة
const data = [
{
type1: 'img',
src1: 'https://cdn.mos.cms.futurecdn.net/DGZWzDLUs8cb3omMNm2fg7-1024-80.jpg.webp',
overlay: {
title: 'Meet TEDDY Plus',
text: 'BIG. ICONIC. SOFT.',
button: {
text: 'تسوق الآن',
link: '/products/teddy-plus'
}
},
type2: 'video',
src2: '',
poster2: 'https://cdn.salla.sa/qQvawW/H1DYTBjQDLwUvSRNLkj4PTmvfpMaqsJmuQMLOjgN.jpg'
},
{
type1: 'img',
src1: 'https://cdn.salla.sa/qQvawW/UiBHZ4NLsH83kXz2UEQWprFBkQZcMlOvem1S8ZGE.jpg',
overlay: {
title: 'Meet TEDDY Plus',
text: 'BIG. ICONIC. SOFT.',
button: {
text: 'تسوق الآن',
link: '/products/teddy-plus'
}
},
type2: 'video',
src2: 'https://res.cloudinary.com/dggfjzsnr/video/upload/v1755087764/8b1fbef103b9d467f072546d190b8bac_t2_veybnc.mp4',
poster2: 'https://cdn.salla.sa/qQvawW/BcNku7N5kUey8yVG4etLlin0eLz4MeMWlMalYeZd.jpg'
},
{
type1: 'img',
src1: 'https://cdn.salla.sa/qQvawW/BcNku7N5kUey8yVG4etLlin0eLz4MeMWlMalYeZd.jpg',
overlay: {
title: 'Meet TEDDY Plus',
text: 'BIG. ICONIC. SOFT.',
button: {
text: 'تسوق الآن',
link: '/products/teddy-plus'
}
},
type2: 'video',
src2: 'https://res.cloudinary.com/dggfjzsnr/video/upload/v1755083970/ba35366422fc4515088230e310591a06_720w_updsxf.mp4',
poster2: 'https://cdn.mos.cms.futurecdn.net/k2YuXSurwJ6QgCzJUMZxf7-1024-80.jpg.webp'
},
];
const grid = document.createElement('div');
grid.className = 'pair-grid';
data.forEach((pairData, index) => {
const pair = document.createElement('div');
pair.className = 'pair';
if (index % 2 !== 0) pair.classList.add('reverse');
const createMediaBox = (type, src, poster, overlay) => {
const box = document.createElement('div');
box.className = 'media-box';
if (type === 'img') {
box.innerHTML = `
`;
if (overlay) {
const { title = '', text = '', button } = overlay;
box.innerHTML += `
${title ? `
${title} ` : ''}
${text ? `
${text}
` : ''}
${button ? `
${button.text} ` : ''}
`;
}
} else if (type === 'video') {
box.innerHTML = `
`;
}
return box;
};
pair.appendChild(createMediaBox(pairData.type1, pairData.src1, pairData.poster1, pairData.overlay));
pair.appendChild(createMediaBox(pairData.type2, pairData.src2, pairData.poster2, pairData.overlay));
grid.appendChild(pair);
});
// ✅ إدراج الـ grid بعد الهيدر
const header = document.querySelector('.index .store-header');
if (header) header.insertAdjacentElement('afterend', grid);
const faqSection = document.createElement("div");
faqSection.classList.add("faq-section"); // تضيفي كلاس عام للقسم إن حبيتي
const targetFAQ = document.querySelector('.product-dimensions');
if (!targetFAQ) return;
// ✅ العنوان
const faqTitle = document.createElement("h2");
faqTitle.innerText = "الأسئلة الشائعة";
faqTitle.style.cssText = `
text-align: center;
color: #0D2C40;
font-size: 1.5rem;
font-weight: 800;
padding-bottom: 0.5rem;
`;
faqSection.appendChild(faqTitle);
const faqData = [
{
question: "ممَ يتكوّن كنبة مودز؟",
answer: "تُغطى كنبة مودز بقماش عالي الجودة يمنحها ملمسًا ناعمًا. كما تحتوي على قضبان لزيادة المتانة والدعم. المراتب مصنوعة عالية الجودة لتوفر توازنًا بين الدعم والراحة."
},
{
question: "هل تحتاج كنبة مودز إلى تجميع؟",
answer: "تحتاج فقط إلى تجميع بسيط؛ يمكن تثبيت القضبان المعدنية يدويًا دون أدوات. بقية الكنبة لا تحتاج إلى تركيب، لذا يمكنك استخدامها فورًا."
},
{
question: "كيف أحول كنبة مودز إلى سرير؟",
answer: "قم بفرد المرتبة العليا على الأرض ثم ثبّت المراتب باستخدام الشرائط اللاصقة (فيلكرو)."
},
{
question: "هل يمكن استخدام كنبة مودز كسرير يومي؟",
answer: "نعم، فهي مصممة بفوم عالي الجودة يوفر الراحة والدعم اللازمين للاستخدام اليومي."
}
];
const faqContainer = document.createElement("div");
faqContainer.style.cssText = `
display: flex;
flex-direction: column;
gap: .25rem;
`;
faqSection.appendChild(faqContainer);
faqData.forEach(({ question, answer }, index) => {
const faqItem = document.createElement("div");
faqItem.className = `faq-item-${index}`;
faqItem.style.cssText = `
background-color: #005bca;
border-radius: 10px;
color: #0D2C40;
overflow: hidden;
transition: all 0.3s ease;
border: 1px solid #d1e6ff;
`;
const questionHeader = document.createElement("div");
questionHeader.style.cssText = `
display: flex;
justify-content: space-between;
align-items: center;
padding: .5rem;
background-color: #005bca;
cursor: pointer;
color: #ffffff;
font-size: 1.1rem;
font-weight: 600;
`;
const questionText = document.createElement("span");
questionText.innerText = question;
const toggleIcon = document.createElement("span");
toggleIcon.innerText = "+";
toggleIcon.style.cssText = `
font-size: 1.5rem;
transition: transform 0.3s ease;
`;
questionHeader.appendChild(questionText);
questionHeader.appendChild(toggleIcon);
faqItem.appendChild(questionHeader);
const answerContent = document.createElement("div");
answerContent.style.cssText = `
padding: 1.5rem;
color: #0D2C40;
font-size: 1rem;
display: none;
background-color: #ffffff;
line-height: 1.6;
`;
answerContent.innerHTML = answer;
faqItem.appendChild(answerContent);
questionHeader.addEventListener("click", () => {
const isOpen = answerContent.style.display === "block";
answerContent.style.display = isOpen ? "none" : "block";
toggleIcon.innerText = isOpen ? "+" : "-";
});
faqContainer.appendChild(faqItem);
});
targetFAQ.insertAdjacentElement('afterend', faqSection);
// ✅ راقب الصفحة حتى يظهر قسم الأسئلة الشائعة
observer.observe(document.body, {
childList: true,
subtree: true
});
// إنشاء العنصر الرئيسي للزر
const progressDiv = document.createElement('div');
progressDiv.id = 'progress';
// لا يوجد محتوى داخلي (لا سهم)
document.body.appendChild(progressDiv);
// تنسيق الزر عبر CSS
const style = document.createElement('style');
style.innerHTML = `
#progress {
position: fixed;
bottom: 30px;
right: 30px;
height: 60px;
width: 60px;
display: none;
border-radius: 50%;
background: conic-gradient(#005bca0%, #eee 0%);
cursor: pointer;
z-index: 9999;
transition: background 0.3s ease;
transform: rotate(-90deg); /* يبدأ من الأعلى */
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
`;
document.head.appendChild(style);
// وظيفة التمرير والتقدم
let calcScrollValue = () => {
const scrollProgress = document.getElementById("progress");
const pos = document.documentElement.scrollTop;
const calcHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight;
const scrollValue = Math.round((pos * 100) / calcHeight);
if (pos > 100) {
scrollProgress.style.display = "block";
} else {
scrollProgress.style.display = "none";
}
scrollProgress.style.background = `conic-gradient(#016bfe ${scrollValue}%, #eee ${scrollValue}%)`;
scrollProgress.onclick = () => {
document.documentElement.scrollTo({ top: 0, behavior: "smooth" });
};
};
window.onscroll = calcScrollValue;
window.onload = calcScrollValue;
const form = document.querySelector('.product-form');
const desc = document.querySelector('.product__description');
if (form && desc) {
desc.parentNode.insertBefore(form, desc); // ينقل الفورم قبل وصف المنتج
}
});
// نراقب DOM حتى يظهر العنصر المطلوب
const observer = new MutationObserver(function (mutations, obs) {
const targetSection = document.querySelector('.product-dimensions');
if (targetSection) {
// أوقف المراقبة
obs.disconnect();
// إنشاء سكشن جديد
const newSection = document.createElement('section');
newSection.className = 'custom-image-section';
newSection.style.textAlign = 'center';
newSection.style.padding = '0px 0';
newSection.style.background = '#005bca';
// إنشاء صورة
const image = document.createElement('img');
image.alt = 'Responsive Custom Image';
image.style.Width = '100%';
image.style.height = 'auto';
// تحديد الصورة حسب نوع الجهاز
function updateImageSource() {
if (window.innerWidth <= 768) {
image.src = 'https://cdn.salla.sa/qQvawW/tIPpLeNXeVWNpJPAfFfP0bezTtZw6rtVidDNbXtI.png';
} else {
image.src = 'https://cdn.salla.sa/qQvawW/gBXBydGSvKGjpv4mwwtTBvC4BGQv4KEoquqPu3SD.png';
}
}
updateImageSource();
window.addEventListener('resize', updateImageSource);
newSection.appendChild(image);
// إضافة السكشن بعد العنصر
targetSection.parentNode.insertBefore(newSection, targetSection.nextSibling);
}
});
// بدء المراقبة على الجسم الكامل للصفحة
observer.observe(document.body, {
childList: true,
subtree: true
});
document.addEventListener("DOMContentLoaded", function () {
const faqSection = document.querySelector('.faq-section') || document.querySelector('#faq-section');
if (!faqSection) return;
// إنشاء السكشن
const section = document.createElement('section');
section.style.cssText = `
width: 100%;
padding: 20px 20px;
background: url('data:image/svg+xml;utf8,
') no-repeat center/cover;
text-align: center;
`;
// الفيديو أعلى الصور (بدون تحكم)
const video = document.createElement('video');
video.src = 'https://breezifi.com/cdn/shop/videos/c/vp/d22879ec8fdc4d66af026fed8fb31b20/d22879ec8fdc4d66af026fed8fb31b20.HD-1080p-2.5Mbps-48248619.mp4?v=0';
video.autoplay = true;
video.loop = true;
video.muted = true;
video.playsInline = true;
video.style.cssText = `
width: 100%;
height: 80vh; object-fit: cover;
border-radius: 2px;
margin-bottom: 30px;
box-shadow: 0 10px 25px rgba(0,0,0,0.2);
outline: none;
`;
section.appendChild(video);
// الصف الأول (الصورتين)
const row1 = document.createElement('div');
row1.style.cssText = `
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 30px;
`;
const img1 = document.createElement('img');
img1.src = 'https://cdn.salla.sa/qQvawW/zeEzj4bKsE2LU4x5WsqG5ssdBmAZSMpMSQfyzoeE.jpg';
img1.style.cssText = `
border-radius: 2px;
`;
const img2 = document.createElement('img');
img2.src = 'https://cdn.salla.sa/qQvawW/6MzHLbioBAxDIPgyxstdpFufcqCV8qYYuKy2lyUe.jpg';
img2.style.cssText = `
border-radius: 2px;
`;
row1.appendChild(img1);
row1.appendChild(img2);
section.appendChild(row1);
// إدراج السكشن قبل faq-section
faqSection.parentNode.insertBefore(section, faqSection);
// ميديا كويري لتعديل الصور على اللابتوب
const style = document.createElement('style');
style.textContent = `
@media (min-width: 992px) {
section div img {
width: calc(50% - 10px);
}
}
`;
document.head.appendChild(style);
});
document.addEventListener("DOMContentLoaded", function () {
const footer = document.querySelector('.index footer');
if (!footer) return;
const section = document.createElement("section");
section.className = "custom-quality-section";
section.innerHTML = `
غير مود بيتك مع مودز!
اطلبها الآن
`;
footer.parentNode.insertBefore(section, footer);
});
function addCustomMobileMenuVertical() {
// لو العرض أقل من 1024 بكسل، ما نعرضش المينو
if (window.innerWidth < 1024) return false;
const container = document.querySelector('.mm-ocd__content');
if (!container) return false;
if (document.getElementById('custom-mobile-menu')) return true;
const nav = document.createElement('nav');
nav.id = "custom-mobile-menu";
nav.className = "custom-menu mm-spn--light mm-spn--navbar mm-spn--main";
nav.setAttribute("data-mm-spn-title", "القائمة الرئيسية");
nav.innerHTML = `
`;
container.appendChild(nav);
// CSS لتظهر العناصر تحت بعض بشكل مرتب
const style = document.createElement('style');
style.innerHTML = `
#custom-mobile-menu { display: block; padding: 15px; background: #fff; }
.custom-menu-list { list-style: none; padding: 0; margin: 0; }
.custom-menu-item { margin: 12px 0; }
.custom-menu-link { text-decoration: none; color: #000; font-size: 18px; font-weight: bold; display: block; padding: 8px 10px; border-radius: 5px; transition: background 0.3s; }
.custom-menu-link:hover { background: #f0f0f0; }
`;
document.head.appendChild(style);
nav.style.display = "block";
nav.style.visibility = "visible";
nav.style.opacity = "1";
return true;
}
// نكرر المحاولة لحد ما العنصر يظهر
const menuInterval = setInterval(() => {
if (addCustomMobileMenuVertical()) {
clearInterval(menuInterval);
}
}, 300);
// لو غير المستخدم حجم الشاشة نعيد الفحص
window.addEventListener('resize', () => {
const menu = document.getElementById('custom-mobile-menu');
if (window.innerWidth < 1024 && menu) {
menu.remove(); // نخفي المينو
} else if (window.innerWidth >= 1024 && !menu) {
addCustomMobileMenuVertical();
}
});