Reserve your watch now!
00 Hours
00 Minutes
00 Seconds
1,000,000 EGP
1,000,000 EGP
ratings 428
Book yours by 50,000
Out of stock
document.addEventListener("DOMContentLoaded", function () {
if (document.body.classList.contains("editor_enable")) return;
// === إعدادات التحكم ===
const disableAllProduct = false;
const disabledVariantIds = [];
const manualOriginalPrice = "4000";
// === عناصر من الـ DOM ===
const desktopBtn = document.getElementById("desktop_add_to_cart");
const mobileBtn = document.getElementById("mobile_add_to_cart");
const addToCartBtn = document.querySelector("#add_to_cart");
const productName = document.querySelector("h1[itemprop='name']");
const currentPrice = document.querySelector(".oe_price .oe_currency_value");
const originalPrice = document.querySelector(".oe_default_price .oe_currency_value");
const stickyName = document.getElementById("sticky_product_name");
const stickyCurrent = document.getElementById("sticky_current_price");
const stickyOriginal = document.getElementById("sticky_original_price");
const mobileCurrent = document.getElementById("mobile_current_price");
const mobileOriginal = document.getElementById("mobile_original_price");
const hourEl = document.getElementById("mobile_hours");
const minuteEl = document.getElementById("mobile_minutes");
const secondEl = document.getElementById("mobile_seconds");
const format = v => Math.floor(parseFloat(v.replace(",", ""))).toLocaleString("en-EG") + " EGP";
if (productName) stickyName.textContent = productName.textContent.trim();
if (currentPrice) {
const val = format(currentPrice.textContent.trim());
stickyCurrent.textContent = "1,000,000 EGP";
mobileCurrent.textContent = "1,000,000 EGP";
}
if (manualOriginalPrice) {
const formatted = Math.floor(parseFloat(manualOriginalPrice.replace(",", ""))).toLocaleString("en-EG") + " EGP";
stickyOriginal.textContent = formatted;
mobileOriginal.textContent = formatted;
stickyOriginal.style.display = "";
mobileOriginal.style.display = "";
} else if (originalPrice && originalPrice.offsetParent !== null) {
const val = format(originalPrice.textContent.trim());
stickyOriginal.textContent = val;
mobileOriginal.textContent = val;
} else {
stickyOriginal.style.display = "none";
mobileOriginal.style.display = "none";
}
const header = document.getElementById("desktop_sticky_header");
window.addEventListener("scroll", () => {
const y = window.scrollY;
header.classList.toggle("scrolled", y > 10);
header.classList.toggle("at-top", y <= 10);
});
function buildVariants(targetId, prefix) {
const holder = document.getElementById(targetId);
const groups = document.querySelectorAll(".js_add_cart_variants > li[data-attribute_id]");
holder.innerHTML = "";
groups.forEach(group => {
const attrId = group.dataset.attribute_id;
const inputs = group.querySelectorAll("input[type='radio']");
const groupWrap = document.createElement("div");
groupWrap.className = "variant-group";
inputs.forEach(input => {
const li = document.createElement("div");
const label = input.closest("label");
const newLabel = document.createElement("label");
newLabel.className = "variant-color" + (input.checked ? " active" : "");
newLabel.style.background = label?.style.background;
const clone = document.createElement("input");
clone.type = "radio";
clone.name = prefix + "-" + attrId;
clone.value = input.value;
newLabel.addEventListener("click", () => {
input.checked = true;
input.dispatchEvent(new Event("change", { bubbles: true }));
groupWrap.querySelectorAll(".variant-color").forEach(el => el.classList.remove("active"));
newLabel.classList.add("active");
checkDisableCondition();
});
newLabel.appendChild(clone);
li.appendChild(newLabel);
groupWrap.appendChild(li);
});
holder.appendChild(groupWrap);
});
}
buildVariants("sticky_variants", "sticky");
buildVariants("mobile_variants", "mobile");
function checkDisableCondition() {
const selectedVariant = document.querySelector(".js_add_cart_variants input[type='radio']:checked");
const selectedVariantId = selectedVariant?.value;
const isDisabled = disableAllProduct || disabledVariantIds.includes(selectedVariantId);
[desktopBtn, mobileBtn].forEach((btn, idx) => {
if (btn) {
btn.disabled = isDisabled;
btn.style.opacity = isDisabled ? "0.5" : "";
btn.style.cursor = isDisabled ? "not-allowed" : "";
const msg = document.getElementById(idx === 0 ? "desktop_out_of_stock_msg" : "mobile_out_of_stock_msg");
if (msg) msg.style.display = isDisabled ? "block" : "none";
}
});
}
function updateTimer() {
const now = Date.now();
const fiveHoursMs = 5 * 60 * 60 * 1000;
const elapsed = now % fiveHoursMs;
const remaining = fiveHoursMs - elapsed;
const totalSeconds = Math.floor(remaining / 1000);
const h = Math.floor(totalSeconds / 3600);
const m = Math.floor((totalSeconds % 3600) / 60);
const s = totalSeconds % 60;
hourEl.textContent = String(h).padStart(2, '0');
minuteEl.textContent = String(m).padStart(2, '0');
secondEl.textContent = String(s).padStart(2, '0');
translateCountdownLabels();
}
updateTimer();
setInterval(updateTimer, 1000);
checkDisableCondition();
translateToArabic();
const handleClick = (e) => {
e.preventDefault();
if (desktopBtn.disabled || mobileBtn.disabled) return;
if (addToCartBtn) addToCartBtn.click();
};
desktopBtn?.addEventListener("click", handleClick);
mobileBtn?.addEventListener("click", handleClick);
function isArabic() {
return document.documentElement.lang === "ar" || document.documentElement.dir === "rtl";
}
function translateToArabic() {
if (!isArabic()) return;
const offerText = document.querySelector(".mobile-countdown .offer-text");
if (offerText) {
offerText.textContent = "صُممت خصيصاً لك!";
}
const desktopBtn = document.getElementById("desktop_add_to_cart");
if (desktopBtn) desktopBtn.textContent = "احجز نسختك بـ50,000";
const mobileBtn = document.getElementById("mobile_add_to_cart");
if (mobileBtn) mobileBtn.textContent = "احجز نسختك بـ50,000";
const ratingsText = document.querySelector(".mobile-ratings span");
if (ratingsText) {
ratingsText.textContent = ratingsText.textContent.replace("ratings 428", "428 تقييم");
}
translateCountdownLabels();
}
function translateCountdownLabels() {
if (!isArabic()) return;
const hourLabel = document.querySelector(".label-hour");
const minuteLabel = document.querySelector(".label-minute");
const secondLabel = document.querySelector(".label-second");
if (hourLabel) hourLabel.textContent = "ساعة";
if (minuteLabel) minuteLabel.textContent = "دقيقة";
if (secondLabel) secondLabel.textContent = "ثانية";
}
});