/* ===== HALA SEARCH START — شريط البحث باسم العباية تحت الفيديو ===== */
(function () {
function searchUrl(q) {
var base = '/search';
try { if (window.salla && salla.url && salla.url.get) base = salla.url.get('search'); } catch (e) {}
return base + (base.indexOf('?') > -1 ? '&' : '?') + 'q=' + encodeURIComponent(q);
}
function build() {
if (!document.body || !document.body.classList.contains('index')) return; // الصفحة الرئيسية بس
if (document.getElementById('hala-search')) return;
var slider = document.querySelector('section.advanced-slider');
if (!slider) return;
var css = ''
+ '#hala-search{background:#3E2C23;color:#FAF7F2;padding:34px 16px;direction:rtl;text-align:center}'
+ '#hala-search h3{margin:0 0 16px;font-size:20px;font-weight:700;color:#FAF7F2}'
+ '#hala-search form{position:relative;max-width:560px;margin:0 auto}'
+ '#hala-search input{width:100%;height:52px;border:0;border-radius:12px;padding:0 50px 0 16px;font-size:15px;background:#FAF7F2;color:#3E2C23;outline:none;box-shadow:0 6px 18px rgba(0,0,0,.18)}'
+ '#hala-search input:focus{box-shadow:0 0 0 2px #B08D57,0 6px 18px rgba(0,0,0,.18)}'
+ '#hala-search button{position:absolute;top:0;right:0;width:50px;height:52px;border:0;background:none;color:#3E2C23;cursor:pointer;display:flex;align-items:center;justify-content:center}'
+ '#hala-search .hala-chips{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-top:14px}'
+ '#hala-search .hala-chips a{padding:6px 16px;border:1px solid #B08D57;border-radius:999px;color:#EDE5DA;font-size:13px;text-decoration:none;transition:.2s}'
+ '#hala-search .hala-chips a:hover{background:#B08D57;color:#3E2C23}';
var style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
// أسماء العبايات اللي تطلع كأزرار سريعة (عدليها براحتك)
var names = ['قمر', 'هيفاء', 'ديبيكا'];
var box = document.createElement('section');
box.id = 'hala-search';
box.innerHTML = ''
+ '
للبحث باسم العباية
'
+ ''
+ ''
+ names.map(function (n) { return '
' + n + ''; }).join('')
+ '
';
box.querySelector('form').addEventListener('submit', function (e) {
e.preventDefault();
var q = box.querySelector('input').value.trim();
if (q) location.href = searchUrl(q);
});
slider.parentNode.insertBefore(box, slider.nextSibling);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', build);
else build();
setTimeout(build, 1500); // احتياط لو السلايدر تأخر
})();
/* ===== HALA SEARCH END ===== */
/* ===== HALA STATS START — إحصائيات بشكل أفقي (أيقونة فوق الرقم) ===== */
(function () {
function buildStats() {
var sec = document.querySelector('.s-block--bundle-statistics');
if (!sec || sec.querySelector('.hala-stats')) return;
var comp = sec.querySelector('[component-name="statistics"]');
if (!comp) return;
var cfg;
try { cfg = JSON.parse(comp.getAttribute('config') || '{}'); } catch (e) { return; }
var items = (cfg.items || []).filter(function (i) { return !i.__hidden; });
if (!items.length) return;
if (!document.getElementById('hala-stats-css')) {
var st = document.createElement('style');
st.id = 'hala-stats-css';
st.textContent = ''
+ '.hala-stats{background:#FAF7F2;padding:44px 16px;direction:rtl}'
+ '.hala-stats__row{display:flex;justify-content:center;align-items:flex-start;gap:12px;max-width:900px;margin:0 auto}'
+ '.hala-stats__item{flex:1;text-align:center;min-width:0}'
+ '.hala-stats__icon{font-size:34px;color:#B08D57;line-height:1;margin-bottom:10px;display:block}'
+ '.hala-stats__num{font-size:34px;font-weight:800;color:#3E2C23;line-height:1.1;margin:0;direction:ltr;unicode-bidi:plaintext}'
+ '.hala-stats__label{font-size:14px;color:#6B5B4E;margin:6px 0 0}'
+ '@media(min-width:768px){.hala-stats{padding:64px 16px}.hala-stats__icon{font-size:46px}.hala-stats__num{font-size:52px}.hala-stats__label{font-size:17px}}';
document.head.appendChild(st);
}
var box = document.createElement('div');
box.className = 'hala-stats';
box.innerHTML = '' + items.map(function (i) {
var num = String(i.numbers || '').trim();
if (num.charAt(0) === '+') num = num.indexOf('%') > -1 ? num.slice(1) : num.slice(1) + '+'; // يطلع 1500+ مثل اس جي
return '
'
+ '
'
+ '
' + num + '
'
+ '
' + (i.name || '') + '
'
+ '
';
}).join('') + '
';
comp.style.display = 'none';
sec.appendChild(box);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', buildStats);
else buildStats();
setTimeout(buildStats, 1500);
})();
/* ===== HALA STATS END ===== */
/* ===== HALA GALLERY START — تصوير عميلاتنا ===== */
(function () {
function buildGallery() {
var sec = document.querySelector('.s-block--photos-slider');
if (!sec || sec.querySelector('.hala-gallery')) return;
var srcs = [];
sec.querySelectorAll('img').forEach(function (img) {
var s = img.getAttribute('data-src') || img.currentSrc || img.src;
if (s && s.indexOf('data:') !== 0 && srcs.indexOf(s) === -1) srcs.push(s);
});
if (!srcs.length) return;
if (!document.getElementById('hala-gallery-css')) {
var st = document.createElement('style');
st.id = 'hala-gallery-css';
st.textContent = ''
+ '.hala-gallery{padding:44px 16px 20px;direction:rtl;text-align:center}'
+ '.hala-gallery h3{margin:0 0 6px;font-size:22px;font-weight:700;color:#3E2C23}'
+ '.hala-gallery p.sub{margin:0 0 20px;font-size:14px;color:#6B5B4E}'
+ '.hala-gallery__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:1100px;margin:0 auto}'
+ '.hala-gallery__item{position:relative;overflow:hidden;border-radius:12px;aspect-ratio:9/14;background:#F3EDE4;cursor:zoom-in}'
+ '.hala-gallery__item img{width:100%;height:100%;object-fit:cover;transition:transform .6s;display:block}'
+ '.hala-gallery__item:hover img{transform:scale(1.06)}'
+ '.hala-gallery__item{opacity:0;transform:translateY(16px) scale(.97);transition:opacity .6s,transform .6s}'
+ '.hala-gallery__item.in{opacity:1;transform:none}'
+ '.hala-lightbox{position:fixed;inset:0;z-index:99999;background:rgba(30,20,15,.92);display:flex;align-items:center;justify-content:center;padding:20px;cursor:zoom-out}'
+ '.hala-lightbox img{max-width:100%;max-height:90vh;border-radius:12px}'
+ '@media(min-width:768px){.hala-gallery__grid{grid-template-columns:repeat(6,1fr);gap:12px}.hala-gallery h3{font-size:28px}}';
document.head.appendChild(st);
}
var box = document.createElement('div');
box.className = 'hala-gallery';
box.innerHTML = 'تصوير عميلاتنا
لحظة وصول طلباتهم 🤎
'
+ ''
+ srcs.map(function (s) { return '
'; }).join('')
+ '
';
Array.prototype.forEach.call(sec.children, function (c) { c.style.display = 'none'; });
sec.appendChild(box);
var items = box.querySelectorAll('.hala-gallery__item');
items.forEach(function (it, i) {
it.addEventListener('click', function () {
var lb = document.createElement('div');
lb.className = 'hala-lightbox';
lb.innerHTML = '
';
lb.addEventListener('click', function () { lb.remove(); });
document.body.appendChild(lb);
});
});
if ('IntersectionObserver' in window) {
var io = new IntersectionObserver(function (ents) {
ents.forEach(function (e) {
if (e.isIntersecting) {
var i = Array.prototype.indexOf.call(items, e.target);
setTimeout(function () { e.target.classList.add('in'); }, (i % 6) * 90);
io.unobserve(e.target);
}
});
}, { threshold: 0.15 });
items.forEach(function (it) { io.observe(it); });
} else {
items.forEach(function (it) { it.classList.add('in'); });
}
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', buildGallery);
else buildGallery();
setTimeout(buildGallery, 1500);
})();
/* ===== HALA GALLERY END ===== */