/* Add custom Js styles below */
// إنشاء زر الواتساب ديناميكيًا (منع التكرار)
if (!document.getElementById('whatsapp-btn')) {
const whatsappButton = document.createElement('div');
whatsappButton.id = 'whatsapp-btn';
whatsappButton.innerHTML = `
`;
// فتح واتساب عند النقر
whatsappButton.onclick = function () {
window.open('https://wa.me/+966562069757', '_blank');
};
// إضافة الزر إلى الصفحة
document.body.appendChild(whatsappButton);
}
// إنشاء عنصر الديف
const footerText = document.createElement('div');
footerText.className = 'custom-footer-text';
footerText.innerHTML = 'تصميم وإدارة شوكفات';
// إضافته إلى نهاية البودي أو أي عنصر آخر مناسب
document.addEventListener("DOMContentLoaded", function() {
document.body.appendChild(footerText);
});
// ========== إعدادات ==========
const WHATSAPP_URL = "https://wa.me/966547226514";
const SITE_URL = "https://shokvat.com";
// تجنب التكرار لو الكود اتشغّل أكتر من مرة
if (!window.__shokvatInjected__) {
window.__shokvatInjected__ = true;
document.addEventListener("DOMContentLoaded", function () {
// 1) إنشاء نص الفوتر بالرابط
let footerText = document.querySelector(".custom-footer-text");
if (!footerText) {
footerText = document.createElement("div");
footerText.className = "custom-footer-text";
footerText.innerHTML = 'تصميم وإدارة شوكفات';
document.body.appendChild(footerText);
} else {
// لو موجود بالفعل، نخلي الرابط يشتغل كبوابة للمودال
const link = footerText.querySelector("a") || (() => {
const a = document.createElement("a");
a.id = "shokvatLink";
a.textContent = "شوكفات";
a.href = "#";
footerText.append(" ", a);
return a;
})();
link.id = "shokvatLink";
link.href = "#";
link.setAttribute("role", "button");
link.removeAttribute("target");
}
// 2) إنشاء المودال بالكامل بالـJS (بدون HTML جاهز)
if (!document.getElementById("shokvatModal")) {
const modal = document.createElement("div");
modal.id = "shokvatModal";
modal.innerHTML = `
تواصل مع شوكفات | خبراء التسويق الرقمي
`;
document.body.appendChild(modal);
// إغلاق بالزر
modal.querySelector(".shokvat-close-btn").addEventListener("click", function () {
modal.style.display = "none";
document.body.classList.remove("shokvat-no-scroll");
});
// إغلاق بالضغط خارج المحتوى
modal.addEventListener("click", function (e) {
if (e.target.id === "shokvatModal") {
modal.style.display = "none";
document.body.classList.remove("shokvat-no-scroll");
}
});
// إغلاق بمفتاح ESC
document.addEventListener("keydown", function (e) {
if (e.key === "Escape" && modal.style.display === "flex") {
modal.style.display = "none";
document.body.classList.remove("shokvat-no-scroll");
}
});
}
// 3) ربط الضغط على "شوكفات" بفتح المودال
const trigger = document.getElementById("shokvatLink");
const modalEl = document.getElementById("shokvatModal");
if (trigger && modalEl) {
trigger.addEventListener("click", function (e) {
e.preventDefault();
modalEl.style.display = "flex";
document.body.classList.add("shokvat-no-scroll");
});
}
});
}
document.addEventListener("DOMContentLoaded", function() {
let buttons = document.querySelectorAll('.s-add-product-button-mini-checkout-content');
buttons.forEach(btn => {
let emoji = document.createElement('span');
emoji.className = 'floating-emoji-inline';
emoji.textContent = '🔥'; // يمكنك تغييره إلى 🎮 أو 💥 أو 🔥 حسب رغبتك
btn.appendChild(emoji);
});
});
document.addEventListener("DOMContentLoaded", function () {
// لا يظهر في الصفحة الرئيسية فقط
if (window.location.pathname !== "/") {
const helpBtn = document.createElement('div');
helpBtn.id = 'floating-help-btn';
helpBtn.innerHTML = `❓`;
helpBtn.style.cssText = `
position: fixed;
bottom: 90px;
left: 20px; /* ← هنا التغيير */
width: 50px;
height: 50px;
background-color: #f97316;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 99999;
box-shadow: 0 4px 12px rgba(0,0,0,0.25);
transition: transform 0.3s ease;
`;
helpBtn.onmouseover = () => {
helpBtn.style.transform = 'scale(1.1)';
};
helpBtn.onmouseout = () => {
helpBtn.style.transform = 'scale(1)';
};
// عند الضغط عليه يفتح نافذة التسجيل
helpBtn.onclick = () => {
if (typeof salla !== 'undefined' && salla.event) {
salla.event.dispatch('login::open');
} else {
alert("حدث خطأ، تأكد من تحميل مكتبة سلة.");
}
};
document.body.appendChild(helpBtn);
}
});
let doc = document, w = window, discountWindow = doc.createElement('div');
discountWindow.id = 'discountWindow';
discountWindow.className = 'discountClass';
discountWindow.style.width = '100%';
discountWindow.style.textAlign = 'center';
discountWindow.style.padding = '20px';
discountWindow.style.border = '2px solid #006C35'; // أخضر سعودي
discountWindow.style.background = 'linear-gradient(135deg, #f0fff4, #e6f9f0)';
discountWindow.style.margin = '15px 0';
discountWindow.style.display = 'flex';
discountWindow.style.flexDirection = 'column';
discountWindow.style.alignItems = 'center';
discountWindow.style.borderRadius = '12px';
discountWindow.style.boxShadow = '0px 0px 20px rgba(0, 108, 53, 0.3)';
discountWindow.style.transition = 'all 0.3s ease-in-out';
discountWindow.style.overflow = 'hidden';
// تأثير دخول أنيق
discountWindow.style.opacity = '0';
discountWindow.style.transform = 'scale(0.9)';
setTimeout(() => {
discountWindow.style.opacity = '1';
discountWindow.style.transform = 'scale(1)';
}, 300);
// شعار اليوم الوطني
let img = document.createElement('img');
img.src = "https://etbilarabi.com/sites/default/files/styles/article_landing/public/2025-08/img_1820.jpeg?itok=qw39_FN3";
img.alt = "اليوم الوطني السعودي 95";
img.style.width = '120px';
img.style.marginBottom = '10px';
img.style.borderRadius = '8px';
// العنوان
let title = document.createElement('div');
title.innerHTML = "🇸🇦 اليوم الوطني السعودي 95 🎉";
title.style.fontWeight = 'bold';
title.style.fontSize = '20px';
title.style.marginBottom = '8px';
title.style.color = '#006C35';
// الرسالة الترويجية
let message = document.createElement('div');
message.innerHTML = "🎁 احتفل معنا واحصل على خصم خاص عند استخدام الكود التالي:";
message.style.fontWeight = 'bold';
message.style.marginBottom = '12px';
message.style.color = '#333';
// حاوية الإدخال والزر
let inputContainer = document.createElement('div');
inputContainer.style.display = 'flex';
inputContainer.style.justifyContent = 'center';
inputContainer.style.alignItems = 'center';
inputContainer.style.marginBottom = '10px';
// حقل الكود
let inputField = document.createElement('input');
inputField.type = 'text';
inputField.value = 'ND95';
inputField.style.padding = '8px';
inputField.style.marginRight = '10px';
inputField.style.borderRadius = '6px';
inputField.style.border = '1px solid #ccc';
inputField.style.width = '130px';
inputField.style.textAlign = 'center';
inputField.readOnly = true;
// زر النسخ
let copyButton = document.createElement('button');
copyButton.textContent = '📋 نسخ الكود';
copyButton.style.backgroundColor = '#006C35';
copyButton.style.color = '#fff';
copyButton.style.border = 'none';
copyButton.style.padding = '8px 16px';
copyButton.style.borderRadius = '6px';
copyButton.style.cursor = 'pointer';
copyButton.style.transition = '0.3s';
copyButton.style.boxShadow = '0 0 10px rgba(0, 108, 53, 0.6)';
// تأثيرات الزر
copyButton.onmouseover = () => {
copyButton.style.backgroundColor = '#004d25';
copyButton.style.boxShadow = '0 0 15px rgba(0, 108, 53, 0.8)';
};
copyButton.onmouseleave = () => {
copyButton.style.backgroundColor = '#006C35';
copyButton.style.boxShadow = '0 0 10px rgba(0, 108, 53, 0.6)';
};
copyButton.onclick = () => {
navigator.clipboard.writeText(inputField.value).then(() => {
copyButton.textContent = '✅ تم النسخ!';
setTimeout(() => copyButton.textContent = '📋 نسخ الكود', 2000);
}).catch(err => alert('حدث خطأ أثناء النسخ!'));
};
inputContainer.appendChild(inputField);
inputContainer.appendChild(copyButton);
// تركيب العناصر
discountWindow.appendChild(img);
discountWindow.appendChild(title);
discountWindow.appendChild(message);
discountWindow.appendChild(inputContainer);
// إضافة النافذة داخل صفحة المنتج (قبل الوصف)
let targetDiv = doc.querySelector('.product__description');
if (targetDiv) {
targetDiv.parentNode.insertBefore(discountWindow, targetDiv);
} else {
console.warn("لم يتم العثور على العنصر .product__description");
}