/* جوليرا – سكربت مخصص: تحويل الزوار العرب للعربي + توضيح عرض الهدية */ (function () { var path = location.pathname; var ua = navigator.userAgent || ''; var isBot = /bot|crawl|spider|slurp|preview|lighthouse|headless|gpt|oai-|claude|perplexity|facebookexternalhit|bingpreview/i.test(ua); function ls(k, v) { try { if (v === undefined) return localStorage.getItem(k); localStorage.setItem(k, v); } catch (e) { return null; } } /* 1) تحويل الزائر السعودي/العربي من /en إلى /ar ما لم يختر الإنجليزي بنفسه */ if (/^\/en(\/|$)/.test(path) && !isBot) { var params = new URLSearchParams(location.search); var ref = document.referrer || ''; if (params.get('lang') === 'en' || (ref.indexOf(location.origin + '/ar') === 0)) { ls('gio_lang', 'en'); /* اختار الإنجليزي من داخل المتجر */ } var langs = (navigator.languages || [navigator.language || '']).join(',').toLowerCase(); var tz = ''; try { tz = Intl.DateTimeFormat().resolvedOptions().timeZone || ''; } catch (e) {} var arURL = '/ar' + path.replace(/^\/en/, '') + location.search + location.hash; var arabicDevice = /(^|,)ar/.test(langs); var gulf = /^Asia\/(Riyadh|Kuwait|Bahrain|Qatar|Dubai|Muscat|Aden)$/.test(tz); if (arabicDevice && ls('gio_lang') !== 'en') { location.replace(arURL); return; } if (gulf && !arabicDevice && ls('gio_lang') !== 'en') { /* جهازه إنجليزي لكنه في الخليج: نعرض اقتراح العربي بدون إجبار */ var showBar = function () { if (document.getElementById('gio-ar-bar')) return; var bar = document.createElement('div'); bar.id = 'gio-ar-bar'; bar.style.cssText = 'position:relative;z-index:50;background:#0B3D2E;color:#fff;padding:9px 16px;display:flex;align-items:center;gap:10px;justify-content:center;font-size:15px;direction:rtl'; bar.innerHTML = '🇸🇦 تصفّح الموقع بالعربي' + ''; bar.querySelector('button').onclick = function () { ls('gio_lang', 'en'); bar.remove(); }; document.body.insertBefore(bar, document.body.firstChild); }; if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', showBar); else showBar(); } } if (/^\/ar(\/|$)/.test(path) && /^\/en/.test((document.referrer || '').replace(location.origin, ''))) { ls('gio_lang', 'ar'); /* رجع للعربي بنفسه */ } var AR = document.documentElement.lang !== 'en'; var L = AR ? '/ar' : '/en'; var SETS = 'c1839419883', GIFTS = ['c735292439', 'c721123725', 'c397050006']; var css = '.gio-gift{background:#FFF1F2;border:2px solid #C8102E;border-radius:12px;padding:14px 16px;margin:12px 0;color:#1b1b1b;font-size:15px;line-height:1.7}' + '.gio-gift b{color:#C8102E;font-size:17px;display:block;margin-bottom:4px}' + '.gio-gift .gio-btns{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}' + '.gio-gift a{background:#C8102E;color:#fff !important;border-radius:999px;padding:7px 14px;font-weight:700;font-size:14px;text-decoration:none}' + '.gio-gift a.alt{background:#fff;color:#C8102E !important;border:1px solid #C8102E}' + '.gio-topbuy{display:flex;gap:10px;margin:4px 0 16px}.gio-topbuy button{flex:1;min-height:48px;border-radius:10px;font-weight:800;font-size:16px}.gio-tb-add{background:#0B3D2E;color:#fff}.gio-tb-buy{background:#fff;color:#0B3D2E;border:1.5px solid #0B3D2E}' + '.promotion-title,.s-product-card-promotion-title{background:#273F41 !important;color:#C8A45C !important}' + '.promotion-title.gio-offer,.s-product-card-promotion-title.gio-offer{background:#C8102E !important;color:#fff !important;font-weight:800 !important;box-shadow:0 2px 8px rgba(200,16,46,.35)}'; var st = document.createElement('style'); st.textContent = css; document.head.appendChild(st); function giftLinks() { return '
' + '' + (AR ? 'اختاري عطر 🎁' : 'Pick a perfume 🎁') + '' + '' + (AR ? 'ساعة نسائية' : "Women's watch") + '' + '' + (AR ? 'ساعة رجالية' : "Men's watch") + '
'; } function box(html) { var d = document.createElement('div'); d.className = 'gio-gift'; d.innerHTML = html; return d; } function pageCfg() { try { return window.salla && salla.config.get('page') || {}; } catch (e) { return {}; } } function productBox() { if (!document.body.classList.contains('product-single') || document.querySelector('.gio-gift')) return; var form = document.querySelector('form.product-form'); if (!form) return; var parent = ((pageCfg().parent || {}).url || '') + ' ' + [].map.call(document.querySelectorAll('main a[href*="/c"]'), function (a) { return a.href; }).join(' '); var b = null; if (parent.indexOf(SETS) > -1) { b = box(AR ? '🎁 هديتك علينا مع هذا الطقمأضيفي الطقم للسلة، وبعدها أضيفي أي عطر أو ساعة وتنخصم قيمتها تلقائياً في السلة.' + giftLinks() : '🎁 Free gift with this setAdd the set to your cart, then add any perfume or watch — it becomes free automatically at checkout.' + giftLinks()); } else if (GIFTS.some(function (c) { return parent.indexOf(c) > -1; })) { b = box(AR ? '🎁 هذا المنتج يصير مجانيلو اشتريتي معه أي طقم فضة 925 من جوليرا.
تصفحي الأطقم
' : '🎁 Get this for freewhen you buy any 925 silver set from Gioielleria.
Browse sets
'); } if (b) form.parentNode.insertBefore(b, form); } var cartKey = null, cartBusy = false; function cartBox() { if (!document.body.classList.contains('cart') || cartBusy || !window.salla || !salla.cart) return; var main = document.querySelector('main'); var key = main ? (main.innerText.match(/[\d٠-٩][\d٠-٩,٬.]*/g) || []).join('|') : ''; if (key === cartKey) return; cartKey = key; cartBusy = true; salla.cart.details().then(function (r) { var cart = (r && r.data && r.data.cart) || {}, items = cart.items || []; var hasSet = items.some(function (i) { return /طقم|\bset\b/i.test(i.product_name || i.name || ''); }); var discounted = Number(cart.total_discount || cart.discount || 0) > 0; var existing = document.querySelector('.gio-gift'); if (hasSet && !discounted) { if (existing) return; var c = document.querySelector('main .container') || main; if (!c) return; c.insertBefore(box(AR ? '🎁 لا تنسين هديتك المجانية!عندك طقم في السلة — أضيفي أي عطر أو ساعة وتصير مجانية تلقائياً.' + giftLinks() : '🎁 Don\'t forget your free gift!You have a set in your cart — add any perfume or watch and it becomes free.' + giftLinks()), c.firstChild); } else if (existing) { existing.remove(); } }).catch(function () {}).then(function () { cartBusy = false; }); } function topBuy() { if (!document.body.classList.contains('product-single')) return; var form = document.querySelector('form.product-form'); if (!form) return; var host = form.querySelector('salla-add-product-button'); var existing = document.querySelector('.gio-topbuy'); var realBtn = host && host.querySelector('button'); var soldOut = (host && host.getAttribute('product-status') === 'out') || (realBtn && (realBtn.disabled || /نفدت|out of stock/i.test(realBtn.textContent))); if (soldOut) { if (existing) existing.remove(); return; } if (existing) return; var desc = document.querySelector('.main-content .product__description'); if (!desc || !host) return; var hasOpts = !!form.querySelector('salla-product-options'); var wrap = document.createElement('div'); wrap.className = 'gio-topbuy'; wrap.innerHTML = '' + ''; function toForm() { form.scrollIntoView({ behavior: 'smooth', block: 'center' }); } wrap.querySelector('.gio-tb-add').onclick = function () { var b = form.querySelector('salla-add-product-button button.s-button-element') || form.querySelector('salla-add-product-button button'); if (hasOpts || !b || b.disabled) return toForm(); b.click(); }; wrap.querySelector('.gio-tb-buy').onclick = function () { var mini = form.querySelector('salla-mini-checkout-widget'); var inner = mini && mini.shadowRoot && mini.shadowRoot.querySelector('button'); if (hasOpts || !mini) return toForm(); (inner || mini).click(); }; desc.parentNode.insertBefore(wrap, desc); } function tagBadges() { [].forEach.call(document.querySelectorAll('.promotion-title:not([data-gio]),.s-product-card-promotion-title:not([data-gio])'), function (e) { e.setAttribute('data-gio', '1'); if (/هدي|مجان|خصم|عرض|تخفيض|free|gift|off|sale|%/i.test(e.textContent)) e.classList.add('gio-offer'); }); } function hideSold() { /* المنتجات النافدة: نشيلها من السلايدرات (الرئيسية وقد يعجبك)، وفي الأقسام تنزل آخر القائمة من إعدادات سلة */ var sw = []; [].forEach.call(document.querySelectorAll('.swiper-slide .s-product-card-out-of-stock'), function (c) { var w = c.closest('.swiper'); c.closest('.swiper-slide').remove(); if (w && sw.indexOf(w) < 0) sw.push(w); }); sw.forEach(function (w) { try { w.swiper && w.swiper.update(); } catch (e) {} }); } function waBtn() { if (document.getElementById('gio-wa') || document.body.classList.contains('cart')) return; var msg = AR ? 'السلام عليكم، عندي سؤال عن: ' : 'Hello, I have a question about: '; var a = document.createElement('a'); a.id = 'gio-wa'; a.href = 'https://wa.me/966535566614?text=' + encodeURIComponent(msg + document.title.split('|')[0].trim() + '\n' + location.href.split('?')[0]); a.target = '_blank'; a.rel = 'noopener'; a.setAttribute('aria-label', 'WhatsApp'); a.style.cssText = 'position:fixed;left:16px;bottom:' + (document.body.classList.contains('product-single') ? '96px' : '24px') + ';z-index:9998;width:54px;height:54px;border-radius:50%;background:#25D366;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 18px rgba(0,0,0,.25)'; a.innerHTML = ''; document.body.appendChild(a); } function fixOptLabel() { if (AR) return; [].forEach.call(document.querySelectorAll('salla-product-options b'), function (b) { [].forEach.call(b.childNodes, function (n) { if (n.nodeType === 3 && n.nodeValue.trim().toLowerCase() === 'option') n.nodeValue = n.nodeValue.replace(/option/i, 'Size'); }); }); } function faqSchema() { if (document.getElementById('gio-faq-ld')) return; var path = location.pathname, pairs = []; function txt(e) { return (e && e.textContent || '').replace(/\s+/g, ' ').trim(); } if (/\/faq\/page-/.test(path)) { [].forEach.call(document.querySelectorAll('main h3, main p > strong:only-child'), function (q) { var host = q.tagName === 'STRONG' ? q.parentElement : q; var a = host.nextElementSibling; if (/[?؟]\s*$/.test(txt(q)) && a && a.tagName === 'P' && !a.querySelector('strong:only-child')) pairs.push([txt(q), txt(a)]); }); } else if (/\/blog\//.test(path)) { var h = [].filter.call(document.querySelectorAll('main h2'), function (e) { return /أسئلة شائعة|FAQ/i.test(txt(e)); })[0]; if (!h) return; for (var e = h.nextElementSibling; e && e.tagName !== 'H2'; e = e.nextElementSibling) { if (e.tagName === 'H3' && e.nextElementSibling && e.nextElementSibling.tagName === 'P') pairs.push([txt(e), txt(e.nextElementSibling)]); } } else return; if (pairs.length < 2) return; var ld = { '@context': 'https://schema.org', '@type': 'FAQPage', mainEntity: pairs.map(function (p) { return { '@type': 'Question', name: p[0], acceptedAnswer: { '@type': 'Answer', text: p[1] } }; }) }; var sc = document.createElement('script'); sc.type = 'application/ld+json'; sc.id = 'gio-faq-ld'; sc.textContent = JSON.stringify(ld); document.head.appendChild(sc); } function catFaq() { if (document.getElementById('gio-cat-faq')) return; var m = location.pathname.match(/\/c(\d+)(?:$|[/?])/); if (!m) return; var D = {"397050006":{"ar":[["كم سعر الساعات النسائية؟","أغلب ساعاتنا النسائية بحدود 199 ريال."],["هل الساعة تنفع هدية مع طقم؟","نعم، الساعات النسائية والرجالية ضمن عرض «اشتري طقم وهديتك علينا» لفترة محدودة."],["هل توصلون بنفس اليوم؟","داخل الرياض نعم، مع مرسول من 4 العصر إلى 12 بالليل."]],"en":[["How much are the women’s watches?","Most of our women’s watches are around SAR 199."],["Can a watch be the free gift with a set?","Yes, women’s and men’s watches are part of the “Buy a set, get a gift” offer for a limited time."],["Do you deliver the same day?","Inside Riyadh, yes, via Mrsool from 4 PM to midnight."]]},"407881499":{"ar":[["كيف أعرف مقاس خاتمي؟","قيسي محيط إصبعك بخيط أو قارني بخاتم عندك، وراجعي دليل المقاسات في مدونتنا، أو زورينا في فرع التحلية ونقيس لك."],["هل فيه خواتم بدون مقاس؟","نعم، الخواتم المفتوحة قابلة للتعديل وتناسب أغلب المقاسات، وتنفع هدية لما ما تعرفين المقاس."],["هل الخواتم فضة أصلية؟","نعم، كل خواتم جوليرا من الفضة الإسترلينية عيار 925."]],"en":[["How do I know my ring size?","Measure your finger with a string or compare with a ring you own, check our size guide on the blog, or visit our Tahlia store."],["Do you have rings without a size?","Yes, open rings are adjustable and fit most sizes, ideal as a gift when you don’t know the size."],["Are the rings real silver?","Yes, all Gioielleria rings are 925 sterling silver."]]},"990897186":{"ar":[["هل حلق الفضة 925 يسبب حساسية؟","الفضة 925 مناسبة لأغلب أنواع البشرة، ولو عندك حساسية من النيكل اسألينا عن القطعة قبل الشراء."],["وش أنواع الحلق المتوفرة؟","عندنا الحلق الصغير (ستد)، والدائري، والمتدلي، والطويل للمناسبات."],["هل الحلق هدية مناسبة؟","نعم، من أسهل الهدايا لأنه ما يحتاج مقاس، وأسعاره تبدأ من أقل من 100 ريال."]],"en":[["Can 925 silver earrings cause allergies?","925 silver suits most skin types; if you are sensitive to nickel, ask us about the piece before buying."],["What earring styles do you have?","Studs, hoops, drops and long statement earrings for occasions."],["Are earrings a good gift?","Yes, one of the easiest gifts since no size is needed, with prices starting under SAR 100."]]},"1839419883":{"ar":[["وش يشمل طقم الفضة 925 من جوليرا؟","الطقم الكامل 4 قطع: عقد وحلق وخاتم وأسورة من الفضة الإسترلينية عيار 925، ونص الطقم تعليقة مع حلق."],["هل ينفع الطقم شبكة أو هدية ملكة؟","نعم، أطقمنا المرصعة من أكثر الاختيارات للشبكة والملكة والذكرى السنوية، وتقدرين تقسطين قيمتها مع تابي وتمارا."],["هل فيه عرض على الأطقم؟","حاليًا مع أي طقم تقدرين تضيفين عطر أو ساعة وتنخصم قيمتها تلقائيًا في السلة، لفترة محدودة."]],"en":[["What does a Gioielleria 925 silver set include?","A complete 4-piece set: necklace, earrings, ring and bracelet in 925 sterling silver; a half set is a necklace with earrings."],["Is a set suitable for a shabka or wedding gift?","Yes, our pavé sets are a popular choice for the shabka, milka and anniversaries, with Tabby and Tamara installments."],["Is there an offer on sets?","Currently, with any set you can add a perfume or watch and its value is deducted automatically in the cart, for a limited time."]]}}; var d = D[m[1]]; if (!d) return; var list = AR ? d.ar : d.en; var main = document.querySelector('main'); if (!main || !document.querySelector('salla-products-list, .s-product-card-entry')) return; var box = document.createElement('section'); box.id = 'gio-cat-faq'; box.className = 'container'; box.style.cssText = 'margin:32px auto;padding:0 16px;max-width:900px'; box.innerHTML = '

' + (AR ? 'أسئلة شائعة' : 'FAQ') + '

' + list.map(function (q) { return '
' + q[0] + '

' + q[1] + '

'; }).join(''); main.appendChild(box); var ld = document.createElement('script'); ld.type = 'application/ld+json'; ld.textContent = JSON.stringify({ '@context': 'https://schema.org', '@type': 'FAQPage', mainEntity: list.map(function (q) { return { '@type': 'Question', name: q[0], acceptedAnswer: { '@type': 'Answer', text: q[1] } }; }) }); document.head.appendChild(ld); } /* بنترست: أيقونة في روابط الحسابات + sameAs لمحركات البحث */ var PIN = 'https://www.pinterest.com/gioielleriaksa/'; function pinLink() { [].forEach.call(document.querySelectorAll('ul.s-social-list'), function (ul) { if (ul.querySelector('a[href*="pinterest"]')) return; var li = document.createElement('li'); li.className = 's-social-link'; li.innerHTML = 'pinterest'; ul.appendChild(li); }); if (!document.getElementById('gio-sameas')) { var s = document.createElement('script'); s.type = 'application/ld+json'; s.id = 'gio-sameas'; s.textContent = JSON.stringify({ '@context': 'https://schema.org', '@type': 'Organization', '@id': 'https://gioielleria.app/#org', name: 'جوليرا Gioielleria', url: 'https://gioielleria.app', sameAs: ['https://www.instagram.com/gioielleriaksa', 'https://www.tiktok.com/@gioielleriaksa', 'https://x.com/gioielleriaksa', 'https://www.snapchat.com/add/gioielleriaksa', PIN] }); document.head.appendChild(s); } } /* فيديوهات الرئيسية: ما تتحمل إلا لما يوصلها الزائر، وتوقف لما يطلع منها */ var vidIO = ('IntersectionObserver' in window) ? new IntersectionObserver(function (es) { es.forEach(function (e) { var vd = e.target; if (e.isIntersecting) { if (!vd.dataset.loaded) { [].forEach.call(vd.querySelectorAll('source[data-src]'), function (s) { s.src = s.dataset.src; }); if (vd.dataset.src) vd.src = vd.dataset.src; vd.dataset.loaded = '1'; vd.load(); } var p = vd.play(); if (p && p.catch) p.catch(function () {}); } else if (vd.dataset.loaded) { vd.pause(); } }); }, { rootMargin: '200px 0px' }) : null; function lazyVid() { [].forEach.call(document.querySelectorAll('video[data-lazy]:not([data-io])'), function (vd) { vd.setAttribute('data-io', '1'); vd.muted = true; if (vidIO) vidIO.observe(vd); else { [].forEach.call(vd.querySelectorAll('source[data-src]'), function (s) { s.src = s.dataset.src; }); vd.load(); } }); } function gioBanners() { var m = document.querySelector('.index main'); if (!m || document.documentElement.lang !== 'ar') return; var vs = document.querySelector('section[component-id="699914442"] video source[data-src]'); if (vs && vs.dataset.src.indexOf('06aeaa81') < 0) vs.dataset.src = 'https://d2ol7oe51mr4n9.cloudfront.net/user_3BiWq32M5d7X5dgCbwOwgQmRLoe/06aeaa81-f74d-4d03-bca9-461f5250063d.mp4'; if (document.getElementById('gio-bnA')) return; var C = 'https://cdn.files.salla.network/other/542991701/', H = 'https://gioielleria.app/-/'; var B = [['c5ba263a-53a3-4235-84b0-77451adef085-original.webp','c1839419883'],['cd3fff07-2ce9-428d-a717-068adab9dab3-original.webp','c171273981'],['d808f96a-6dcb-4d2f-ab4d-ea645715786c-original.webp','c1839419883'],['8a52081f-b73e-45ab-9b67-0ede721e1c88-original.webp','c397050006'],['ecb5d248-3f4e-4435-bad4-98fef54a9576-standard.webp','c407881499']]; function mk(id, list) { var s = document.createElement('section'); s.id = id; s.setAttribute('component-id', id); s.className = 's-block gio-bn'; s.innerHTML = '
' + list.map(function (i) { return 'جوليرا Gioielleria - مجوهرات فضة 925'; }).join('') + '
'; m.appendChild(s); } mk('gio-bnA', [0, 1]); mk('gio-bnB', [2, 3, 4]); } function run() { tagBadges(); hideSold(); productBox(); topBuy(); cartBox(); waBtn(); fixOptLabel(); faqSchema(); catFaq(); pinLink(); gioBanners(); lazyVid(); } function start() { run(); var t; new MutationObserver(function () { clearTimeout(t); t = setTimeout(run, 400); }) .observe(document.body, { childList: true, subtree: true }); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start(); })();