// ===== 1. Checkout Widget Style Injection =====
setTimeout(() => {
const shadowHost = document.querySelector("salla-mini-checkout-widget");
if (shadowHost && shadowHost.shadowRoot) {
const shadowRoot = shadowHost.shadowRoot;
const style = document.createElement("style");
style.textContent = `
.s-fast-checkout-button {
border: 1px solid #fff !important;
border-radius: 20px !important;
}
`;
shadowRoot.appendChild(style);
}
}, 2000);
// ===== 2. Buy Count Customization (Product Page) =====
// This selector is for the product page - safely skip if not found
const buyCount = document.querySelector(
".sidebar__inner .mb-5.flex.items-center.text-sm div span",
);
if (buyCount) {
buyCount.innerText = "عدة مرات";
buyCount.style.setProperty("color", "#ee8323", "important");
}
// ===== 3. Thank You Page Customization =====
const currentPage = document.location.pathname;
const thankYou = currentPage.split("/")[1];
if (thankYou === "thankyou") {
const thankYouContainer = document.querySelector(".container .bg-white");
const thankYouTitle = document.querySelector(".container .bg-white .flex h1");
const thankYouBox = document.querySelector(
".container .bg-white .bg-gray-50",
);
const allParagraphs = document.querySelectorAll(
".container .bg-white article p",
);
if (thankYouContainer) thankYouContainer.classList.add("changeBg");
if (thankYouTitle) thankYouTitle.classList.add("tyh1");
if (thankYouBox) thankYouBox.classList.add("boxTy");
allParagraphs.forEach((p) => {
p.classList.add("tyP");
});
}
// ===== 4. Banner Injection (Microsoft/Gifts/Games) =====
const bannerTarget = document.querySelector(
".s-block--photos-slider + .s-block--banners",
);
if (bannerTarget) {
bannerTarget.innerHTML = `
`;
}
// ===== 5. Footer Logo Customization =====
const footerLogo = document.querySelector("a.footer-logo img");
if (footerLogo) {
footerLogo.src = "https://i.postimg.cc/5y0PdvYZ/riddle.gif";
}
// ===== 6. Category Popup Modal =====
// Add the modal HTML to the banner section
const boxsalla = document.querySelector(".boxsalla");
if (boxsalla) {
boxsalla.innerHTML += `
اختر من بين التصنيفات
`;
}
// Modal control functions with smooth animations
function opnes() {
const bg = document.querySelector(".bg");
if (bg) {
bg.classList.add("modal-open");
}
}
function closee() {
const bg = document.querySelector(".bg");
if (bg) {
bg.classList.remove("modal-open");
}
}
// Category content definitions
const categoryContent = {
// Store (ستور) - PlayStation Store
link1: `
`,
// Xbox (اكس بوكس)
link2: `
`,
// Valorant (فالورانت)
link4: `
`,
// iTunes (أيتونز)
link5: `
`,
// Discord Nitro (ديسكورد نيترو)
link6: `
`,
};
// Attach click handlers to the 6 sub-category items
const subCategoryItems = document.querySelectorAll(
".has-6-photos .banner-entry",
);
if (subCategoryItems.length >= 6) {
// Item 1: Store (ستور)
subCategoryItems[0].onclick = function (e) {
e.preventDefault();
opnes();
const linksContainer = document.querySelector(".bg .masseg .links");
const masseg = document.querySelector(".bg .masseg");
if (linksContainer) linksContainer.innerHTML = categoryContent.link1;
};
// Item 2: Xbox (اكس بوكس)
subCategoryItems[1].onclick = function (e) {
e.preventDefault();
opnes();
const linksContainer = document.querySelector(".bg .masseg .links");
const masseg = document.querySelector(".bg .masseg");
if (linksContainer) linksContainer.innerHTML = categoryContent.link2;
};
// Item 4: Valorant (فالورانت)
subCategoryItems[3].onclick = function (e) {
e.preventDefault();
opnes();
const linksContainer = document.querySelector(".bg .masseg .links");
const masseg = document.querySelector(".bg .masseg");
if (linksContainer) linksContainer.innerHTML = categoryContent.link4;
};
// Item 5: iTunes (أيتونز)
subCategoryItems[4].onclick = function (e) {
e.preventDefault();
opnes();
const linksContainer = document.querySelector(".bg .masseg .links");
const masseg = document.querySelector(".bg .masseg");
if (linksContainer) linksContainer.innerHTML = categoryContent.link5;
};
// Item 6: Discord Nitro (ديسكورد نيترو)
subCategoryItems[5].onclick = function (e) {
e.preventDefault();
opnes();
const linksContainer = document.querySelector(".bg .masseg .links");
const masseg = document.querySelector(".bg .masseg");
if (linksContainer) linksContainer.innerHTML = categoryContent.link6;
};
// Disable default links for items with modals (skip item 3 - Office Programs)
subCategoryItems.forEach((item, index) => {
if (index < 6 && index !== 2) {
// Skip index 2 (item 3 - Office Programs)
const link = item.querySelector("a");
if (link) {
link.href = "#";
link.removeAttribute("href");
}
}
});
}
// Close modal when clicking outside or on close button
document.addEventListener("click", function (event) {
const bg = document.querySelector(".bg");
const closeBtn = document.querySelector(".close");
if (
bg &&
(event.target === bg ||
event.target === closeBtn ||
event.target.closest(".close"))
) {
closee();
}
});