// =====================================================
// 1. Brand Categories Section - Fast setTimeout Version
// =====================================================
(function() {
'use strict';
let sectionInserted = false;
const brands = [
{
name: 'جوالات أبل',
image: 'https://i.postimg.cc/Gm6mfZSh/5016a4df-b011-4488-9587-f18f6252935a-removebg-preview.png',
url: 'https://wg-tele.com/apple-products/c1400704329'
},
{
name: 'جوالات سامسونج',
image: 'https://i.postimg.cc/52D2rZkM/256-144-1-removebg-preview.png',
url: 'https://wg-tele.com/samsung-smart-phones/c2103843300'
},
{
name: 'جوالات هونر',
image: 'https://i.postimg.cc/t4CfFJXL/images.png',
url: 'https://wg-tele.com/honor-smart-phones/c1486691839'
},
{
name: 'جوالات ايتل',
image: 'https://i.postimg.cc/t4CfFJqQ/images-1.png',
url: 'https://wg-tele.com/itel-smartphone/c913033300'
},
{
name: 'جوالات انفنكس',
image: 'https://i.postimg.cc/vZqKhyBC/Uw5-RFBIScg-V1w60-RYO72-Nu-Cc-Gb-Mv-Ei-T1-U4f2-A6-MI.jpg',
url: 'http://wg-tele.com/infinix-smart-phone/c2053476885'
},
{
name: 'جوالات تكنو',
image: 'https://i.postimg.cc/VkLTXvf1/images-2.png',
url: 'https://wg-tele.com/tecno-smart-phones/c313027847'
},
{
name: 'جوالات نوكيا',
image: 'https://i.postimg.cc/dVgVfzSJ/images-3-removebg-preview.png',
url: 'https://wg-tele.com/nokia-smart-phones/c65493125'
},
{
name: 'جوالات متنوعة',
image: 'https://i.postimg.cc/W1Wy8V3B/images-4.png',
url: 'https://wg-tele.com/Xiaomi-phones/c423325670'
}
];
function insertBrandsSection() {
if (sectionInserted || document.querySelector('.brand-categories-section')) {
sectionInserted = true;
return true;
}
const canonicalLink = document.querySelector('link[rel="canonical"]');
if (!canonicalLink || canonicalLink.href !== 'https://wg-tele.com/smart-phones/c191198880') {
return false;
}
const breadcrumb = document.querySelector('.s-breadcrumb-wrapper');
if (!breadcrumb) {
return false;
}
const section = document.createElement('section');
section.className = 'brand-categories-section';
section.innerHTML = `
`;
breadcrumb.parentNode.insertBefore(section, breadcrumb);
sectionInserted = true;
if (!document.getElementById('brand-categories-styles')) {
const style = document.createElement('style');
style.id = 'brand-categories-styles';
style.textContent = `
.brand-categories-section {
width: 100%;
padding: 20px 0;
background: #fff;
margin-bottom: 15px;
}
.brand-categories-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 15px;
}
.brand-categories-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 20px;
justify-items: center;
}
.brand-category-item {
display: flex;
flex-direction: column;
align-items: center;
text-decoration: none;
transition: transform 0.3s ease;
}
.brand-category-item:hover {
transform: translateY(-5px);
}
.brand-image-wrapper {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
border: 3px solid #f0f0f0;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
.brand-category-item:hover .brand-image-wrapper {
border-color: #007bff;
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}
.brand-image-wrapper img {
width: 100%;
height: 100%;
object-fit: contain;
}
.brand-name {
margin-top: 10px;
font-size: 14px;
color: #333;
text-align: center;
font-weight: 500;
}
.brand-category-item:hover .brand-name {
color: #007bff;
}
@media (max-width: 768px) {
.brand-categories-grid {
grid-template-columns: repeat(4, 1fr);
gap: 15px;
}
.brand-image-wrapper {
width: 80px;
height: 80px;
padding: 8px;
}
.brand-name {
font-size: 12px;
}
}
@media (max-width: 480px) {
.brand-categories-section {
padding: 15px 0;
}
.brand-categories-grid {
grid-template-columns: repeat(4, 1fr);
gap: 10px;
}
.brand-image-wrapper {
width: 70px;
height: 70px;
border-width: 2px;
padding: 8px;
}
.brand-name {
font-size: 10px;
margin-top: 8px;
}
}
@media (max-width: 360px) {
.brand-categories-grid {
grid-template-columns: repeat(4, 1fr);
gap: 8px;
}
.brand-image-wrapper {
width: 60px;
height: 60px;
padding: 6px;
}
.brand-name {
font-size: 10px;
}
}
`;
document.head.appendChild(style);
}
return true;
}
setTimeout(insertBrandsSection, 100);
setTimeout(insertBrandsSection, 300);
setTimeout(insertBrandsSection, 500);
setTimeout(insertBrandsSection, 800);
setTimeout(insertBrandsSection, 1200);
setTimeout(insertBrandsSection, 1500);
setTimeout(insertBrandsSection, 2000);
})();
// =====================================================
// 2. Showroom Section - ONLY for body.index
// =====================================================
(function() {
'use strict';
let showroomInserted = false;
function createShowroomSection() {
// تحقق من أن الصفحة هي body.index فقط
if (!document.body.classList.contains('index')) {
return false;
}
// تحقق من عدم التكرار
if (showroomInserted || document.querySelector('#taif-showrooms-section')) {
showroomInserted = true;
return false;
}
const targetSection = document.getElementById('IRT__testimonials-19');
if (!targetSection) {
return false;
}
const newSection = document.createElement('section');
newSection.id = 'taif-showrooms-section';
newSection.style.padding = '20px';
newSection.style.textAlign = 'center';
newSection.style.width = '1324px';
newSection.style.margin = '0 auto';
newSection.style.boxSizing = 'border-box';
newSection.style.maxWidth = '100%';
const text = document.createElement('p');
text.textContent = 'معارضنا داخل الطائف';
text.style.marginBottom = '20px';
text.style.fontSize = '32px';
text.style.fontWeight = '900';
function createLocationIcon(fillPath = '#7947ec', fillCircle = '#fff') {
const svgNS = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(svgNS, "svg");
svg.setAttribute("width", "16");
svg.setAttribute("height", "16");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("fill", "none");
svg.style.verticalAlign = 'middle';
svg.style.marginRight = '6px';
const path1 = document.createElementNS(svgNS, "path");
path1.setAttribute("d", "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z");
path1.setAttribute("fill", fillPath);
const path2 = document.createElementNS(svgNS, "circle");
path2.setAttribute("cx", "12");
path2.setAttribute("cy", "9");
path2.setAttribute("r", "2.5");
path2.setAttribute("fill", fillCircle);
svg.appendChild(path1);
svg.appendChild(path2);
return svg;
}
function createButton(textContent, isFilled) {
const btn = document.createElement('button');
btn.style.margin = '0 10px';
btn.style.padding = '10px 20px';
btn.style.fontSize = '16px';
btn.style.cursor = 'pointer';
btn.style.display = 'inline-flex';
btn.style.alignItems = 'center';
btn.style.borderRadius = '9px';
btn.style.border = isFilled ? 'none' : '2px solid #7947ec';
btn.style.backgroundColor = isFilled ? '#7947ec' : 'transparent';
btn.style.color = isFilled ? 'white' : '#7947ec';
btn.style.fontWeight = '600';
btn.style.transition = 'background-color 0.3s, color 0.3s';
const icon = createLocationIcon(
isFilled ? '#fff' : '#7947ec',
isFilled ? '#7947ec' : '#fff'
);
btn.appendChild(icon);
const spanText = document.createElement('span');
spanText.textContent = textContent;
btn.appendChild(spanText);
btn.addEventListener('mouseenter', () => {
btn.style.backgroundColor = '#5a31c8';
btn.style.color = 'white';
const iconPath = icon.querySelector('path');
const iconCircle = icon.querySelector('circle');
if (iconPath) iconPath.setAttribute('fill', '#fff');
if (iconCircle) iconCircle.setAttribute('fill', '#5a31c8');
});
btn.addEventListener('mouseleave', () => {
if (isFilled) {
btn.style.backgroundColor = '#7947ec';
btn.style.color = 'white';
const iconPath = icon.querySelector('path');
const iconCircle = icon.querySelector('circle');
if (iconPath) iconPath.setAttribute('fill', '#fff');
if (iconCircle) iconCircle.setAttribute('fill', '#7947ec');
} else {
btn.style.backgroundColor = 'transparent';
btn.style.color = '#7947ec';
const iconPath = icon.querySelector('path');
const iconCircle = icon.querySelector('circle');
if (iconPath) iconPath.setAttribute('fill', '#7947ec');
if (iconCircle) iconCircle.setAttribute('fill', '#fff');
}
});
return btn;
}
const mapsLinks = {
'فرع البيعة': 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3318.011552367684!2d40.39824031517139!3d21.26835198315316!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x15c1c5ed86a2a991%3A0x650b52dffdb3d7a6!2sAl%20Bai\'ah%2C%20Taif%2C%20Saudi%20Arabia!5e0!3m2!1sen!2sus!4v1678644885642!5m2!1sen!2sus',
'فرع العنقري': 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3316.5248436290997!2d40.4634093151726!3d21.298731783030473!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x15c1c7876f969dbb%3A0x3b23510b2c7d80a9!2sAl%20Anqari%2C%20Taif%2C%20Saudi%20Arabia!5e0!3m2!1sen!2sus!4v1678644885642!5m2!1sen!2sus'
};
const button1 = createButton('فرع البيعة', true);
const button2 = createButton('فرع العنقري', false);
const buttonsContainer = document.createElement('div');
buttonsContainer.style.marginBottom = '20px';
buttonsContainer.appendChild(button1);
buttonsContainer.appendChild(button2);
const map = document.createElement('iframe');
map.src = mapsLinks['فرع البيعة'];
map.width = '100%';
map.height = '300';
map.style.border = '0';
map.allowFullscreen = true;
map.loading = 'lazy';
map.referrerPolicy = 'no-referrer-when-downgrade';
function activateButton(activeBtn, inactiveBtn, branchName) {
activeBtn.style.backgroundColor = '#7947ec';
activeBtn.style.color = 'white';
activeBtn.style.border = 'none';
let icon = activeBtn.querySelector('svg');
if (icon) {
const iconPath = icon.querySelector('path');
const iconCircle = icon.querySelector('circle');
if (iconPath) iconPath.setAttribute('fill', '#fff');
if (iconCircle) iconCircle.setAttribute('fill', '#7947ec');
}
inactiveBtn.style.backgroundColor = 'transparent';
inactiveBtn.style.color = '#7947ec';
inactiveBtn.style.border = '2px solid #7947ec';
icon = inactiveBtn.querySelector('svg');
if (icon) {
const iconPath = icon.querySelector('path');
const iconCircle = icon.querySelector('circle');
if (iconPath) iconPath.setAttribute('fill', '#7947ec');
if (iconCircle) iconCircle.setAttribute('fill', '#fff');
}
if (mapsLinks[branchName]) {
map.src = mapsLinks[branchName];
}
}
button1.addEventListener('click', () => activateButton(button1, button2, 'فرع البيعة'));
button2.addEventListener('click', () => activateButton(button2, button1, 'فرع العنقري'));
newSection.appendChild(text);
newSection.appendChild(buttonsContainer);
newSection.appendChild(map);
targetSection.insertAdjacentElement('afterend', newSection);
showroomInserted = true;
return true;
}
// محاولات متعددة للإدراج
setTimeout(createShowroomSection, 100);
setTimeout(createShowroomSection, 300);
setTimeout(createShowroomSection, 500);
setTimeout(createShowroomSection, 800);
setTimeout(createShowroomSection, 1200);
setTimeout(createShowroomSection, 1500);
setTimeout(createShowroomSection, 2000);
})();
// =====================================================
// 3. Add Special Image
// =====================================================
setTimeout(function() {
var target = document.querySelector("#IRT__specialPro-18 .container .grid > div:nth-child(2)");
if (target) {
var img = document.createElement("img");
img.src = "https://i.ibb.co/BHXJGqgd/578.jpg";
img.alt = "Special Image";
img.style.maxWidth = "100%";
target.appendChild(img);
}
}, 500);
// =====================================================
// 4. Auto Load More Products
// =====================================================
setTimeout(function() {
const loadBtn = document.querySelector('.s-infinite-scroll-btn');
if (loadBtn) {
loadBtn.style.display = 'none';
}
window.addEventListener('scroll', function() {
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 800)) {
const btn = document.querySelector('.s-infinite-scroll-btn');
if (btn) {
btn.click();
}
}
});
setInterval(function() {
const btn = document.querySelector('.s-infinite-scroll-btn');
if (btn) {
btn.click();
}
}, 2000);
}, 100);
// =====================================================
// 5. Certificates Section Before Footer
// =====================================================
setTimeout(function() {
const footer = document.querySelector('footer');
if (document.querySelector('.certificates-section')) {
return;
}
const certificationDiv = document.createElement('div');
certificationDiv.className = 'certificates-section main-section';
const h1 = document.createElement('h1');
h1.textContent = 'نفخر ونعتز بشهادات الجهات المعتمدة';
const p = document.createElement('p');
p.textContent = 'شهادات تثبت الثقة لعملائنا وأننا نضمن لهم أفضل الجودة والخدمات';
const imagesDiv = document.createElement('div');
imagesDiv.className = 'certificates-images';
const certificates = [
{
img: 'https://img.imgdd.com/d4a9acdb-4c18-4e0b-b7b6-5b54a9b6acb2.png',
link: 'https://maroof.sa/businesses/details/182774',
alt: 'شهادة معروف'
},
{
img: 'https://img.imgdd.com/13272aea-6fd8-45a5-bff6-5ff4d6b0cf8d.png',
link: 'https://drive.google.com/file/d/1DQO7Ztxev_Z6SrFbubwXtskgPX24tbPY/view',
alt: 'شهادة جوجل درايف'
},
{
img: 'https://img.imgdd.com/2de9583f-9919-440b-bdc5-023f5b68799c.webp',
link: '',
alt: 'شهادة الأعمال السعودية'
},
{
img: 'https://img.imgdd.com/20ad9a65-050a-4a8f-aeda-ef02a7ef1174.png',
link: 'https://eauthenticate.saudibusiness.gov.sa/certificate-details/0000006349',
alt: 'شهادة إضافية'
}
];
certificates.forEach(cert => {
const link = document.createElement('a');
link.href = cert.link;
link.target = '_blank';
link.className = 'certificate-link';
const img = document.createElement('img');
img.src = cert.img;
img.alt = cert.alt;
img.className = 'certificate-image';
link.appendChild(img);
imagesDiv.appendChild(link);
});
certificationDiv.appendChild(h1);
certificationDiv.appendChild(p);
certificationDiv.appendChild(imagesDiv);
if (!document.getElementById('certificates-styles')) {
const style = document.createElement('style');
style.id = 'certificates-styles';
style.textContent = `
.certificates-section.main-section {
width: 100%;
padding: 60px 20px;
position: relative;
text-align: center;
color: #7849e9;
}
.certificates-section.main-section h1 {
font-size: 2.5rem;
font-weight: bold;
margin-bottom: 20px;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.certificates-section.main-section p {
font-size: 1.2rem;
line-height: 1.8;
max-width: 600px;
margin: 0 auto 40px auto;
opacity: 0.9;
color: #878080;
}
.certificates-images {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 30px;
margin-top: 30px;
}
.certificate-link {
display: block;
transition: transform 0.3s ease;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.certificate-link:hover {
transform: translateY(-5px) scale(1.05);
}
.certificate-image {
width: 150px;
height: 150px;
object-fit: contain;
padding: 10px;
border-radius: 10px;
display: block;
}
@media (max-width: 768px) {
.certificates-images {
gap: 20px;
}
.certificate-image {
width: 120px;
height: 120px;
}
.certificates-section.main-section h1 {
font-size: 37px;
font-weight: bold;
margin-bottom: 20px;
max-width: 1318px;
margin-left: auto;
margin-right: auto;
line-height: 44px;
}
}
`;
document.head.appendChild(style);
}
if (footer) {
footer.parentNode.insertBefore(certificationDiv, footer);
} else {
document.body.appendChild(certificationDiv);
}
}, 500);
// =====================================================
// 6. Add Images After Product Cards
// =====================================================
setTimeout(function() {
function addImages() {
const imageEls = document.querySelectorAll('.s-product-card-image');
imageEls.forEach(el => {
if (!el.classList.contains('has-added-img')) {
const img = document.createElement('img');
img.src = 'https://cdn.salla.sa/form-builder/DkQ0K3KJSNlAkiPDB4odPNox3vqotSLZ0I9cw1Nt.webp';
img.classList.add('custom-added-img');
el.parentNode.insertBefore(img, el.nextSibling);
el.classList.add('has-added-img');
}
});
}
addImages();
const container = document.querySelector('.products-container') || document.body;
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.addedNodes.length > 0) {
addImages();
}
});
});
observer.observe(container, { childList: true, subtree: true });
}, 500);
// =====================================================
// 7. Add Authorized Agent Badge
// =====================================================
setTimeout(function() {
const targetElement = document.querySelector('.flex.rtl\\:space-x-reverse.space-x-2.items-end');
if (targetElement && targetElement.parentNode && !document.querySelector('.my-custom-wrapper')) {
const newDiv = document.createElement('div');
newDiv.classList.add('my-custom-wrapper');
const textSpan = document.createElement('span');
textSpan.textContent = 'وكيل معتمد';
textSpan.style.fontWeight = 'bold';
textSpan.style.marginRight = '8px';
const img = document.createElement('img');
img.src = 'https://img.imgdd.com/14180323-972b-4e50-b859-b5d755e5d086.png';
img.alt = 'وكيل معتمد';
img.style.width = '50px';
img.style.height = '50px';
img.style.objectFit = 'contain';
newDiv.appendChild(textSpan);
newDiv.appendChild(img);
targetElement.parentNode.insertBefore(newDiv, targetElement.nextSibling);
}
}, 500);
// =====================================================
// 8. Add Emkan Installment Image to Menu
// =====================================================
setTimeout(function() {
function addEmkanImage() {
const menuList = document.querySelector('.top-navbar .salla-menu.hydrated .s-menu-topnav-list') ||
document.querySelector('.s-menu-topnav-list');
if (menuList && !menuList.querySelector('img[alt="Emkan Installment"]')) {
const img = document.createElement('img');
img.src = 'https://i.ibb.co/TqvtzV0T/emkan-installment-mini-1.png';
img.alt = 'Emkan Installment';
img.style.height = '30px';
img.style.width = 'auto';
img.style.marginLeft = '10px';
menuList.appendChild(img);
}
}
addEmkanImage();
setTimeout(addEmkanImage, 1000);
}, 100);
// =====================================================
// 9. Auto-Click Load More When Visible
// =====================================================
setTimeout(function() {
function autoClickLoadMore() {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const button = entry.target;
const loader = button.querySelector('.s-infinite-scroll-btn-loader');
const isLoading = loader && loader.style.display !== 'none';
if (!isLoading && button.style.display !== 'none') {
setTimeout(() => {
button.click();
}, 100);
}
}
});
}, {
threshold: 0.5,
rootMargin: '50px'
});
function observeButtons() {
const buttons = document.querySelectorAll('.s-infinite-scroll-btn');
buttons.forEach(button => {
if (!button.hasAttribute('data-auto-observed')) {
observer.observe(button);
button.setAttribute('data-auto-observed', 'true');
}
});
}
observeButtons();
const mutationObserver = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'childList') {
const addedNodes = Array.from(mutation.addedNodes);
const hasNewButton = addedNodes.some(node => {
return node.nodeType === 1 && (
node.classList?.contains('s-infinite-scroll-btn') ||
node.querySelector?.('.s-infinite-scroll-btn')
);
});
if (hasNewButton) {
setTimeout(observeButtons, 100);
}
}
});
});
mutationObserver.observe(document.body, {
childList: true,
subtree: true
});
}
autoClickLoadMore();
}, 100);