element
function createBrandItem(originalItem) {
const href = originalItem.getAttribute('href');
const img = originalItem.querySelector('img');
const clone = document.createElement('a');
clone.className = 'marquee-item';
clone.href = href;
const imgClone = document.createElement('img');
imgClone.src = img.src;
imgClone.alt = img.alt || '';
clone.appendChild(imgClone);
return clone;
}
/**
* Build a "seamless" marquee by:
* - appending all items once
* - appending them again (duplicated)
* so total width is effectively 200% (two sets).
*/
function createSeamlessMarquee(container, items, direction) {
// The content that moves (two sets inside)
const content = document.createElement('div');
content.className = 'marquee-content';
// Insert one full set
items.forEach(item => {
content.appendChild(createBrandItem(item));
});
// Insert the second (identical) set
items.forEach(item => {
content.appendChild(createBrandItem(item));
});
// Attach the direction class if needed
if (direction === 'right') {
container.classList.add('marquee-right');
} else {
container.classList.add('marquee-left');
}
container.appendChild(content);
}
// 5) Row 1: normal order (scroll left or right depending on CSS)
createSeamlessMarquee(row1, brandItems, 'left');
// 6) Row 2: reversed array so it “starts from the end brand”
const reversedItems = [...brandItems].reverse();
createSeamlessMarquee(row2, reversedItems, 'right');
// 7) Add both rows to the wrapper
marqueeWrapper.appendChild(row1);
marqueeWrapper.appendChild(row2);
// 8) Insert the new marquee before the original grid
originalGrid.parentNode.insertBefore(marqueeWrapper, originalGrid);
// 9) Hide the original grid
originalGrid.classList.add('carousel-replaced');
});
////////B2B SERVCICES PAGE/////////////
document.addEventListener("DOMContentLoaded", function() {
// Only run on the B2B page (URL includes "page-431007162")
if (!window.location.href.includes("page-431007162")) return;
// Create a container for contact info
const contactContainer = document.createElement("div");
contactContainer.className = "custom-contact-info";
// Insert your contact details (phone, email, WhatsApp).
contactContainer.innerHTML = `
لدينا فريق مخصص لخدمات الشركات (B2B) جاهز للرد على استفساراتكم وتلبية احتياجاتكم.
`;
// Select the main container
const singlePageContent = document.querySelector('.content.content--single-page');
if (!singlePageContent) return;
// -----------
// OPTION A: Place the block right AFTER the paragraph, BEFORE the comments
// -----------
const contentEntry = singlePageContent.querySelector('.content-entry');
if (contentEntry) {
// Find the paragraph element
const firstParagraph = contentEntry.querySelector('p');
if (firstParagraph) {
// Insert our contact info block right after that paragraph
firstParagraph.insertAdjacentElement('afterend', contactContainer);
return; // done
}
}
// -----------
// OPTION B: If the paragraph not found, fallback to bottom of .content--single-page
// -----------
singlePageContent.insertAdjacentElement('beforeend', contactContainer);
});
//////////////////////////////////////////////////
// -----------
// CONTACT US PAGE
// -----------
//////////////////////////////////////////////////
document.addEventListener("DOMContentLoaded", function() {
// Only run if URL includes "page-159325515"
if (!window.location.href.includes("page-159325515")) return;
// Create a container for contact info
const contactContainer = document.createElement("div");
contactContainer.className = "contact-us-info";
// Insert your contact details (phone, email, WhatsApp)
// without the "تواصل معنا" heading
contactContainer.innerHTML = `
لدينا فريق جاهز للرد على استفساراتكم وتلبية احتياجاتكم.
`;
// Insert it right after the paragraph in .content-entry
const singlePageContent = document.querySelector('.content.content--single-page');
if (!singlePageContent) return;
const contentEntry = singlePageContent.querySelector('.content-entry');
if (contentEntry) {
const firstParagraph = contentEntry.querySelector('p');
if (firstParagraph) {
// Place our contact info right after that paragraph
firstParagraph.insertAdjacentElement('afterend', contactContainer);
return;
}
}
// Fallback: if no found, just insert at the bottom of .content--single-page
singlePageContent.insertAdjacentElement('beforeend', contactContainer);
});