document.addEventListener("DOMContentLoaded", function () {
const rightHeader = document.querySelector('#mainnav .flex.items-center.justify-end');
if (!rightHeader) return;
// منع التكرار
if (document.querySelector('.language-switcher')) return;
const langSwitcher = document.createElement("div");
langSwitcher.className = "language-switcher";
// تحديد اللغة الحالية من URL أو إعدادات الموقع
const currentLang = location.pathname.startsWith("/en") ? "en" : "ar";
let html = "";
if (currentLang === "ar") {
html = `
English
`;
} else {
html = `
العربية
`;
}
langSwitcher.innerHTML = html;
rightHeader.prepend(langSwitcher);
});
// انتظر الصفحة تحمل
document.addEventListener("DOMContentLoaded", function() {
const searchBtn = document.querySelector('#mainnav .special-header-icon.header-btn__icon.search');
if(searchBtn) {
// لو الصفحة LTR
if(document.documentElement.dir === "ltr") {
searchBtn.style.marginRight = "0.5rem";
searchBtn.style.marginLeft = "0.5rem";
}
// لو الصفحة RTL
if(document.documentElement.dir === "rtl") {
searchBtn.style.marginLeft = "0.5rem";
searchBtn.style.marginRight = "1rem";
}
}
});
document.addEventListener("DOMContentLoaded", function () {
if (document.documentElement.lang === "en") {
// تغيير اتجاه الصفحة للـ LTR
document.querySelector(".container").setAttribute("dir","ltr");
// سكشن 1
document.getElementById("title1").innerText = "Atyab Alnafea";
document.getElementById("p1").innerText =
"Atyab Alnafea was founded in 1998 in the Kingdom of Saudi Arabia, driven by a clear vision to create perfumes that combine tradition and high quality.";
document.getElementById("p2").innerText =
"Today, we continue our journey by expanding in Saudi Arabia, reaffirming our commitment to growth and delivering a complete fragrance experience.";
document.getElementById("founder").innerText = "Mr. Faisal Alnafea";
// سكشن 2
document.getElementById("title2").innerText = "Our Collection";
document.getElementById("p3").innerText =
"We blend notes of rose, the depth of oud, the warmth of musk and amber, and elegant touches of sandalwood to present a balanced fragrance collection that combines longevity and luxury.";
document.getElementById("p4").innerText =
"Each perfume we design is crafted with care to be more than just a scent… it’s an experience that reflects taste and identity.";
// سكشن 3
document.getElementById("title3").innerText = "Quality & Certification";
document.getElementById("p5").innerText =
"We operate according to an ISO 9001:2015 certified quality management system, and our brand is officially registered, reflecting our commitment to professionalism.";
}
});