/* Add custom JS code below */// Custom js === 14 - 10 -2026 (function () { document.addEventListener("DOMContentLoaded", () => { const path = window.location.pathname; if (path === '/ar' || path === '/ar/') { let top_sall = document.createElement('div'); let div_container = document.createElement('div'); let top_sall_desc = document.createElement('p'); top_sall.classList.add('top-sall'); div_container.classList.add('container'); top_sall.appendChild(div_container); div_container.appendChild(top_sall_desc); top_sall_desc.innerHTML = 'خصومات تصل إلى 50% .. تسوق الحين!'; document.body.prepend(top_sall); } }); // const path = window.location.pathname; // if (path === '/' || path === '/ghayaonline.com') { // let top_sall = // document.createElement('div'), // div_container = // document.createElement('div'), // top_sall_desc = // document.createElement('p'), // top_sall_span = // document.createElement('span'); // top_sall.classList.add('top-sall'); // div_container.classList.add('container'); // top_sall.appendChild(div_container); // div_container.appendChild(top_sall_desc); // top_sall_desc.innerHTML = // 'خصومات تصل إلى 50% .. تسوق الحين!'; // document.body.prepend(top_sall); // } ///////// ///////////////////// let top_nav_logo = document.querySelector('.s-menu-topnav-list'); // top_nav_logo.appendChild(span) // Header Search document.querySelector('.header-search').classList.add('flex-0') // Main Catgs Title & Other secs if (path === '/' || path === '/ghayaonline.com') { function addSectionTitle(sectionNumber, title) { let section_title_wrap = document.createElement('div'); let diiv_container = document.createElement('div'); let sec_title = document.createElement('h2'); section_title_wrap.classList.add('section_title-wrap'); diiv_container.classList.add('container'); sec_title.textContent = title; diiv_container.appendChild(sec_title); section_title_wrap.appendChild(diiv_container); let existing_section = document.querySelector( `section:nth-of-type(${sectionNumber})` ); if (existing_section) { existing_section.before(section_title_wrap); } } addSectionTitle(2, "الأقسام الرئيسية"); addSectionTitle(12, "العناية اليومية"); // addSectionTitle(16, "الفيتامينات والتغذية الصحية"); } // //////////////////////////////////// // Cart text let cart_empty_text = document.querySelector('[data-testid="store-cart-empty"] p'); if (cart_empty_text) { cart_empty_text.textContent = "ليس لديك أي عناصر في سلة التسوق الخاصة بك حتى الآن"; } /////////////////////////////////////////// // let footer_copy_txt = document.querySelector('.store-footer > div:last-child'); // console.log(footer_copy_txt); /////////////////////////////////////////// // Footer Copy Right Text // let footer_copy_txt = document.querySelector('.store-footer > div:last-child'); // if (footer_copy_txt) { // let span = document.createElement('span'); // span.className = 'footer-copy'; // span.style.cssText = 'display:inline-flex;align-items:center;gap:5px;'; // span.appendChild(document.createTextNode('تم التصميم بواسطة ')); // let link = document.createElement('a'); // link.href = 'https://www.coreations.com/'; // link.textContent = 'كوريشنز'; // link.target = '_blank'; // link.rel = 'noopener noreferrer'; // let logo = document.createElement('img'); // logo.src = 'https://www.coreations.com/media/dpufoch5/coreations-logo-only-white-feb-2021.png'; // logo.alt = 'كوريشنز'; // logo.style.cssText = 'width:45px;height:45px;object-fit:contain;display: inline-block;margin: 7px 0 0 0'; // span.appendChild(link); // link.appendChild(logo); // span.appendChild(logo); // footer_copy_txt.appendChild(span); // } let footer_copy_txt = document.querySelector('.store-footer > div:last-child'); if (footer_copy_txt) { let span = document.createElement('span'); span.className = 'footer-copy'; span.style.cssText = 'display:inline-flex;align-items:center;gap:5px;'; span.appendChild(document.createTextNode('تم التصميم بواسطة ')); let link = document.createElement('a'); link.href = 'https://www.coreations.com/'; link.textContent = 'كوريشنز'; link.target = '_blank'; link.rel = 'noopener noreferrer'; let logo = document.createElement('img'); logo.src = 'https://www.coreations.com/media/dpufoch5/coreations-logo-only-white-feb-2021.png'; logo.alt = 'كوريشنز'; logo.style.cssText = 'width:45px;height:45px;object-fit:contain;display: inline-block;margin: 0 7px 0 0'; link.style.cssText = 'margin-top: 3px'; span.appendChild(link); link.appendChild(logo); footer_copy_txt.appendChild(span); } document.querySelector('.store-footer__inner > div > div > div.leading-6').textContent = 'من مكة المكرمة إلى مختلف أنحاء المملكة، تواصل صيدليات غاية رحلتها الممتدة لأكثر من 25 عامًا في توفير احتياجات الصحة والجمال والعناية الشخصية لعملائها.'; })(); ///////////////////////////////////// (function () { 'use strict'; /* ========================================================= GHAYA - NATIONAL DAY POPUP SYSTEM 1) Popup عام: - يظهر في الهوم والتصنيفات والمقالات وغيرها - يحتوي على كود الخصم SND96 - زر نسخ الكود - زر اكتشف العروض 2) Popup صفحة العروض: - يظهر فقط في /ar/exclusive-offers/c408561169 - Popup صغير للكود فقط 3) يستثني: - المنتجات - السلة - الدفع - الحساب - الطلبات ========================================================= */ /* ========================================================= SETTINGS ========================================================= */ var OFFERS_PATH = '/ar/exclusive-offers/c408561169'; var OFFERS_URL = 'https://ghayaonline.com/ar/exclusive-offers/c408561169'; var DISCOUNT_CODE = 'SND96'; var FLAG_URL = 'https://i.postimg.cc/8PX8FdnH/falcon-saudi-flag-transparent.webp'; /* ========================================================= PAGE HELPERS ========================================================= */ function getPath() { return window.location.pathname || '/'; } function isOffersPage() { var path = getPath(); return ( path === OFFERS_PATH || path.indexOf(OFFERS_PATH + '/') === 0 ); } function isProductPage() { var path = getPath(); return ( path.indexOf('/product/') !== -1 || path.indexOf('/products/') !== -1 ); } function isCartPage() { var path = getPath(); return ( path.indexOf('/cart') !== -1 || path.indexOf('/basket') !== -1 ); } function isCheckoutPage() { var path = getPath(); return ( path.indexOf('/checkout') !== -1 || path.indexOf('/payment') !== -1 || path.indexOf('/order/') !== -1 ); } function isAccountPage() { var path = getPath(); return ( path.indexOf('/profile') !== -1 || path.indexOf('/account') !== -1 || path.indexOf('/orders') !== -1 || path.indexOf('/login') !== -1 || path.indexOf('/register') !== -1 ); } function isExcludedPage() { return ( isProductPage() || isCartPage() || isCheckoutPage() || isAccountPage() ); } /* ========================================================= COPY FUNCTION ========================================================= */ function copyDiscountCode(button) { var code = DISCOUNT_CODE; function success() { button.textContent = 'تم نسخ الكود ✓'; button.classList.add('copied'); setTimeout(function () { button.textContent = 'نسخ الكود'; button.classList.remove('copied'); }, 2500); } if ( navigator.clipboard && navigator.clipboard.writeText ) { navigator.clipboard .writeText(code) .then(success) .catch(function () { fallbackCopy(code, success); }); } else { fallbackCopy(code, success); } } function fallbackCopy(code, success) { var textarea = document.createElement('textarea'); textarea.value = code; textarea.style.position = 'fixed'; textarea.style.opacity = '0'; document.body.appendChild(textarea); textarea.focus(); textarea.select(); try { document.execCommand('copy'); success(); } catch (e) { alert( 'انسخ الكود يدويًا: ' + code ); } textarea.remove(); } /* ========================================================= GENERAL POPUP ========================================================= */ function initGeneralPopup() { /* صفحة العروض لها Popup خاص بها */ if (isOffersPage()) { return; } /* صفحات المنتجات والسلة والدفع والحساب لا يظهر فيها Popup */ if (isExcludedPage()) { return; } /* منع التكرار */ if ( document.getElementById( 'ghaya-national-day-popup' ) ) { return; } /* ======================================================= CSS ======================================================= */ var style = document.createElement('style'); style.id = 'ghaya-national-day-popup-style'; style.textContent = ` #ghaya-national-day-popup { position: fixed; right: 24px; bottom: 24px; width: 420px; max-width: calc(100vw - 32px); z-index: 999999; direction: rtl; opacity: 0; visibility: hidden; transform: translateY(35px) scale(.97); transition: opacity .45s ease, transform .5s cubic-bezier(.22,.61,.36,1), visibility .45s ease; font-family: inherit; } #ghaya-national-day-popup.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); } .ghaya-general-card { position: relative; overflow: hidden; background: #fff; border-radius: 20px; border: 1px solid rgba(19,104,75,.12); box-shadow: 0 20px 50px rgba(24,54,44,.16), 0 5px 15px rgba(24,54,44,.08); } .ghaya-general-top-line { height: 5px; background: linear-gradient( 90deg, #087d54, #0b9b68, #087d54 ); } .ghaya-general-inner { position: relative; padding: 20px; overflow: hidden; } .ghaya-general-close { position: absolute; top: 11px; left: 11px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f3f6f4; color: #52635d; font-size: 20px; cursor: pointer; z-index: 20; } .ghaya-general-close:hover { background: #e8efeb; color: #075c3e; } .ghaya-general-header { display: flex; align-items: center; gap: 13px; padding-left: 38px; margin-bottom: 12px; position: relative; z-index: 3; } .ghaya-general-flag-box { width: 74px; height: 52px; flex: 0 0 74px; display: flex; align-items: center; justify-content: center; perspective: 500px; } .ghaya-general-flag { width: 76px; height: auto; display: block; transform-origin: left center; filter: drop-shadow( 0 5px 7px rgba(0,72,48,.16) ); animation: ghayaGeneralFlag 2.8s ease-in-out infinite; } @keyframes ghayaGeneralFlag { 0%,100% { transform: perspective(500px) rotateY(0deg) rotateZ(0deg); } 25% { transform: perspective(500px) rotateY(-9deg) rotateZ(1deg); } 50% { transform: perspective(500px) rotateY(7deg) rotateZ(-1deg); } 75% { transform: perspective(500px) rotateY(-5deg) rotateZ(1deg); } } .ghaya-general-kicker { margin-bottom: 3px; color: #7b8982; font-size: 11px; font-weight: 700; } .ghaya-general-title { margin: 0; color: #164c3b; font-size: 21px; line-height: 1.3; font-weight: 800; } .ghaya-general-description { margin: 0 0 14px; color: #65736d; font-size: 13px; line-height: 1.7; } /* ========================= CODE BOX ========================= */ .ghaya-general-code-box { display: flex; align-items: center; gap: 8px; padding: 6px; margin-bottom: 12px; border: 2px dashed #0b806f; border-radius: 13px; background: #f3fbf8; } .ghaya-general-code { flex: 1; direction: ltr; color: #006c35; font-size: 21px; font-weight: 900; letter-spacing: 2px; } .ghaya-general-copy { border: 0; border-radius: 9px; padding: 10px 13px; background: #0b806f; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; } .ghaya-general-copy:hover { background: #006c35; } .ghaya-general-copy.copied { background: #006c35; } /* ========================= OFFERS BUTTON ========================= */ .ghaya-general-action { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 43px; padding: 0 18px; border-radius: 11px; background: linear-gradient( 135deg, #087d54, #0a9967 ); color: #fff !important; text-decoration: none !important; font-size: 13px; font-weight: 800; box-shadow: 0 7px 16px rgba(8,125,84,.20); transition: .2s ease; } .ghaya-general-action:hover { transform: translateY(-2px); box-shadow: 0 10px 21px rgba(8,125,84,.28); } .ghaya-general-arrow { font-size: 17px; } @media (max-width:600px) { #ghaya-national-day-popup { right: 10px; left: 10px; bottom: 10px; width: auto; } .ghaya-general-inner { padding: 16px; } .ghaya-general-header { gap: 9px; padding-left: 34px; } .ghaya-general-flag-box { width: 58px; height: 42px; flex-basis: 58px; } .ghaya-general-flag { width: 62px; } .ghaya-general-title { font-size: 17px; } .ghaya-general-description { font-size: 11px; margin-bottom: 10px; } .ghaya-general-code { font-size: 19px; } .ghaya-general-copy { padding: 9px 11px; } } `; document.head.appendChild(style); /* ======================================================= HTML ======================================================= */ var popup = document.createElement('div'); popup.id = 'ghaya-national-day-popup'; popup.innerHTML = `
علم المملكة العربية السعودية
احتفالًا باليوم الوطني السعودي

عروض اليوم الوطني

استفد من خصمك الخاص بمناسبة اليوم الوطني 🎉

${DISCOUNT_CODE}
اكتشف العروض الآن ←
`; document.body.appendChild(popup); /* ======================================================= CLOSE ======================================================= */ var closeButton = popup.querySelector( '.ghaya-general-close' ); closeButton.addEventListener( 'click', function () { popup.classList.remove('show'); setTimeout(function () { popup.remove(); style.remove(); }, 450); } ); /* ======================================================= COPY ======================================================= */ var copyButton = popup.querySelector( '.ghaya-general-copy' ); copyButton.addEventListener( 'click', function () { copyDiscountCode(copyButton); } ); /* ======================================================= SHOW ======================================================= */ setTimeout(function () { if ( document.body.contains(popup) && !isOffersPage() && !isExcludedPage() ) { popup.classList.add('show'); } }, 2500); } /* ========================================================= OFFERS PAGE POPUP ========================================================= */ function initOffersPopup() { if (!isOffersPage()) { return; } if ( document.getElementById( 'ghaya-offers-discount-popup' ) ) { return; } /* ======================================================= CSS ======================================================= */ var style = document.createElement('style'); style.id = 'ghaya-offers-discount-style'; style.textContent = ` #ghaya-offers-discount-popup { position: fixed; inset: 0; z-index: 1000000; display: flex; align-items: center; justify-content: center; padding: 15px; background: rgba(0,0,0,.48); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); direction: rtl; opacity: 0; visibility: hidden; transition: .3s ease; } #ghaya-offers-discount-popup.show { opacity: 1; visibility: visible; } .ghaya-offers-card { position: relative; width: min(350px,100%); background: #fff; border-radius: 20px; overflow: hidden; text-align: center; box-shadow: 0 25px 70px rgba(0,0,0,.25); transform: translateY(20px) scale(.96); transition: .35s ease; } #ghaya-offers-discount-popup.show .ghaya-offers-card { transform: translateY(0) scale(1); } .ghaya-offers-header { position: relative; padding: 18px 18px 16px; background: linear-gradient( 135deg, #006c35, #008348, #087d54 ); color: #fff; } .ghaya-offers-flag { width: 70px; height: 43px; object-fit: contain; display: block; margin: 0 auto 5px; animation: ghayaOffersFlag 2.2s ease-in-out infinite; } @keyframes ghayaOffersFlag { 0%,100% { transform: perspective(500px) rotateY(0deg); } 25% { transform: perspective(500px) rotateY(-8deg); } 50% { transform: perspective(500px) rotateY(5deg); } 75% { transform: perspective(500px) rotateY(-4deg); } } .ghaya-offers-close { position: absolute; top: 10px; left: 10px; width: 29px; height: 29px; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 19px; cursor: pointer; } .ghaya-offers-title { margin: 0; font-size: 19px; font-weight: 800; } .ghaya-offers-subtitle { margin: 4px 0 0; font-size: 12px; } .ghaya-offers-body { padding: 20px 18px 22px; } .ghaya-offers-text { margin: 0 0 14px; color: #444; font-size: 14px; line-height: 1.7; font-weight: 600; } .ghaya-offers-code-box { display: flex; align-items: center; gap: 8px; padding: 6px; border: 2px dashed #0b806f; border-radius: 13px; background: #f3fbf8; } .ghaya-offers-code { flex: 1; direction: ltr; color: #006c35; font-size: 22px; font-weight: 900; letter-spacing: 2px; } .ghaya-offers-copy { border: 0; border-radius: 9px; padding: 10px 13px; background: #0b806f; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; } .ghaya-offers-copy.copied { background: #006c35; } @media (max-width:480px) { .ghaya-offers-card { width: min(330px,100%); } .ghaya-offers-body { padding: 18px 15px 20px; } .ghaya-offers-code { font-size: 20px; } } `; document.head.appendChild(style); /* ======================================================= HTML ======================================================= */ var overlay = document.createElement('div'); overlay.id = 'ghaya-offers-discount-popup'; overlay.innerHTML = `
علم السعودية

كود الخصم جاهز 🎁

استخدمه عند إتمام طلبك

انسخ الكود واستفد من خصم اليوم الوطني 🇸🇦

${DISCOUNT_CODE}
`; document.body.appendChild(overlay); /* ======================================================= CLOSE ======================================================= */ var closeButton = overlay.querySelector( '.ghaya-offers-close' ); closeButton.addEventListener( 'click', function () { overlay.classList.remove( 'show' ); setTimeout(function () { overlay.remove(); style.remove(); }, 350); } ); /* ======================================================= CLICK OUTSIDE ======================================================= */ overlay.addEventListener( 'click', function (event) { if ( event.target === overlay ) { closeButton.click(); } } ); /* ======================================================= COPY ======================================================= */ var copyButton = overlay.querySelector( '.ghaya-offers-copy' ); copyButton.addEventListener( 'click', function () { copyDiscountCode(copyButton); } ); /* ======================================================= SHOW ======================================================= */ setTimeout(function () { if ( document.body.contains(overlay) && isOffersPage() ) { overlay.classList.add( 'show' ); } }, 900); } /* ========================================================= INITIALIZE ========================================================= */ function initialize() { /* لو صفحة العروض: شغل Popup الكود فقط */ if (isOffersPage()) { initOffersPopup(); return; } /* باقي الموقع: شغل Popup اليوم الوطني */ initGeneralPopup(); } /* ========================================================= START ========================================================= */ if ( document.readyState === 'loading' ) { document.addEventListener( 'DOMContentLoaded', initialize ); } else { initialize(); } })();