/* Add custom JS code below */ (function () { var HERO = "https://i.ibb.co/yFN7DydZ/magnific-use-the-exact-same-image-oh-TUe-RK829.jpg"; document.addEventListener('DOMContentLoaded', function () { hideHeader(); buildHeader(); if (isHomePage()) buildHero(); setupScroll(); }); function isHomePage() { var path = window.location.pathname.replace(/\/+$/, ''); return path === '' || path === '/index'; } // نخفي فقط الهيدر/الناف الأصلي لسلة، وما نلمس شريط الفلترة/الترتيب فوق المنتجات function hideHeader() { ['header', '.site-header', '.header', '.header-wrapper', '[class*="announcement"]'] .forEach(function(s){ document.querySelectorAll(s).forEach(function(el){ if (el.id && el.id.indexOf('lb-') === 0) return; el.style.cssText += 'display:none!important'; }); }); // نخفي بس النافقيشن الرئيسي الأصلي (مو أي nav داخل صفحة المنتجات) document.querySelectorAll('body > nav, header nav, .main-nav, .navbar').forEach(function(el){ el.style.cssText += 'display:none!important'; }); } function buildHeader() { var h = document.createElement('header'); h.id = 'lb-header'; h.innerHTML = '' + 'Lush Beauty' + ''; document.body.prepend(h); var ov = document.createElement('div'); ov.id = 'lb-overlay'; ov.onclick = lbCloseAll; document.body.appendChild(ov); var drw = document.createElement('div'); drw.id = 'lb-drawer'; drw.innerHTML = '
Lush Beauty
' + '' + '

لأن كل تفصيلة تعكس جمالك

'; document.body.appendChild(drw); var sm = document.createElement('div'); sm.id = 'lb-search-modal'; sm.innerHTML = '' + ''; document.body.appendChild(sm); } function buildHero() { document.querySelectorAll('.slideshow,[class*="slideshow"],.banner,[class*="hero-banner"]').forEach(function(el){ el.style.cssText += 'display:none!important'; }); var hero = document.createElement('section'); hero.id = 'lb-hero'; hero.innerHTML = 'Lush Beauty' + '
' + '
' + '

أظافر تليق بذوقك

' + '
أكثر من 500 عميلة سعيدة
' + 'تسوقي الآن' + '
'; var h = document.getElementById('lb-header'); h ? h.after(hero) : document.body.prepend(hero); } function setupScroll() { var h = document.getElementById('lb-header'); window.addEventListener('scroll', function(){ if (h) h.classList.toggle('scrolled', scrollY > 40); }, {passive:true}); } window.lbOpenDrawer = function(){ document.getElementById('lb-drawer').classList.add('open'); document.getElementById('lb-overlay').classList.add('show'); document.getElementById('lb-menu-btn').classList.add('open'); }; window.lbOpenSearch = function(){ document.getElementById('lb-search-modal').classList.add('open'); document.getElementById('lb-overlay').classList.add('show'); setTimeout(function(){document.getElementById('lb-search-input').focus();},150); }; window.lbCloseAll = function(){ ['lb-drawer','lb-search-modal'].forEach(function(id){ var el=document.getElementById(id); if(el) el.classList.remove('open'); }); var ov=document.getElementById('lb-overlay'); if(ov) ov.classList.remove('show'); var mb=document.getElementById('lb-menu-btn'); if(mb) mb.classList.remove('open'); }; })();