/* ======================================== Dev: elaGnabey ======================================== */ document.addEventListener("DOMContentLoaded", function () { setTimeout(renderMultiColTables, 800); }); function renderMultiColTables() { var selectors = [ ".product-details__description", ".product__description", "#description", ".description-content", "article", ".pro-details" ]; selectors.forEach(function (selector) { document.querySelectorAll(selector).forEach(processContainer); }); } function processContainer(targetElement) { if (!targetElement || targetElement.dataset.tableDone) return; var htmlContent = targetElement.innerHTML; var regex = /\|جدول\|([\s\S]*?)\|الجدول\|/g; if (!regex.test(htmlContent)) return; var newHtml = htmlContent.replace(regex, function (match, tableContent) { var cleanText = tableContent .replace(//gi, "\n") .replace(/<\/p>/gi, "\n") .replace(/<[^>]*>/g, "") .replace(/ /g, " "); var rows = cleanText.split("\n"); var tableHTML = '
'; tableHTML += ''; var isFirstRow = true; rows.forEach(function (row) { row = row.trim(); if (!row) return; var cols = row.split("|"); if (isFirstRow) { tableHTML += ""; cols.forEach(function (col) { tableHTML += ""; }); tableHTML += ""; isFirstRow = false; } else { tableHTML += ""; cols.forEach(function (col) { tableHTML += ""; }); tableHTML += ""; } }); tableHTML += "
" + col.trim() + "
" + col.trim() + "
"; /* elaGnabey */ tableHTML += ""; tableHTML += "
"; return tableHTML; }); targetElement.innerHTML = newHtml; targetElement.dataset.tableDone = "1"; } document.addEventListener("DOMContentLoaded", initTables); window.addEventListener("load", initTables); function initTables() { setTimeout(renderMultiColTables, 500); setTimeout(renderMultiColTables, 1500); setTimeout(renderMultiColTables, 3000); } function renderMultiColTables() { var selectors = [ ".product-details__description", ".product__description", "#description", ".description-content", "article", ".pro-details", ]; selectors.forEach(function (selector) { document.querySelectorAll(selector).forEach(processContainer); }); } function processContainer(targetElement) { if (!targetElement || targetElement.dataset.tableDone) return; var htmlContent = targetElement.innerHTML; var regex = /\|جدول\|([\s\S]*?)\|الجدول\|/g; if (!regex.test(htmlContent)) return; var newHtml = htmlContent.replace(regex, function (match, tableContent) { var cleanText = tableContent .replace(//gi, "\n") .replace(/<\/p>/gi, "\n") .replace(/<[^>]*>/g, "") .replace(/ /g, " "); var rows = cleanText.split("\n"); var tableHTML = ''; var isFirstRow = true; rows.forEach(function (row) { row = row.trim(); if (!row) return; var cols = row.split("|"); if (isFirstRow) { tableHTML += ""; cols.forEach(col => tableHTML += ""); tableHTML += ""; isFirstRow = false; } else { tableHTML += ""; cols.forEach(col => tableHTML += ""); tableHTML += ""; } }); tableHTML += "
" + col.trim() + "
" + col.trim() + "
"; return tableHTML; }); targetElement.innerHTML = newHtml; targetElement.dataset.tableDone = "1"; } document.addEventListener("DOMContentLoaded", function () { // Developer: Belal Ahmed | Portfolio: https://bekahseo.com/ | Contact: https://belalkahmed.com/ var _devInfo = {n: "Belal Ahmed", w1: "https://bekahseo.com/", w2: "https://belalkahmed.com/"}; function renderFAQ() { var selectors = [ ".product-details__description", ".product__description", "#description", ".description-content", "article", ".pro-details", ]; for (var i = 0; i < selectors.length; i++) { var found = document.querySelectorAll(selectors[i]); if (found.length > 0) { found.forEach(processFAQ); } } } function processFAQ(targetElement) { var htmlContent = targetElement.innerHTML; var faqRegex = /\|اسئلة\|([\s\S]*?)\|نهاية\|/g; if (htmlContent.match(faqRegex)) { var faqData = []; // مصفوفة لحفظ الأسئلة والأجوبة للـ Schema var newHtml = htmlContent.replace(faqRegex, function(match, faqContent) { var cleanText = faqContent .replace(//gi, "\n") .replace(/<\/p>/gi, "\n") .replace(/<[^>]*>/g, "") .replace(/ /g, " "); var lines = cleanText.split('\n'); var faqHTML = '
'; var currentQ = ''; var currentA = ''; for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); if (!line) continue; if (line.indexOf('س:') === 0 || line.indexOf('س :') === 0) { if (currentQ && currentA) { faqData.push({ question: currentQ, answer: currentA }); } if (currentQ) { faqHTML += '
'; } currentQ = line.replace(/س\s*:\s*/, '').trim(); currentA = ''; faqHTML += '
'; faqHTML += '

' + currentQ + '

'; } else if (line.indexOf('ج:') === 0 || line.indexOf('ج :') === 0) { currentA = line.replace(/ج\s*:\s*/, '').trim(); faqHTML += '

' + currentA + '

'; faqHTML += '
'; } } if (currentQ && currentA) { faqData.push({ question: currentQ, answer: currentA }); } if (currentQ) { faqHTML += ''; } faqHTML += ''; if (faqData.length > 0) { addFAQSchema(faqData); } return faqHTML; }); targetElement.innerHTML = newHtml; } } function addFAQSchema(faqData) { var oldSchema = document.getElementById('faq-schema'); if (oldSchema) { oldSchema.remove(); } var schemaData = { "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [] }; for (var i = 0; i < faqData.length; i++) { schemaData.mainEntity.push({ "@type": "Question", "name": faqData[i].question, "acceptedAnswer": { "@type": "Answer", "text": faqData[i].answer } }); } var script = document.createElement('script'); script.id = 'faq-schema'; script.type = 'application/ld+json'; script.text = JSON.stringify(schemaData); document.head.appendChild(script); } renderFAQ(); setTimeout(renderFAQ, 1500); }); /* Add custom Js styles below */ (function() { // Create the WhatsApp button element const whatsappBtn = document.createElement('a'); whatsappBtn.href = 'https://wa.me/966593279523'; whatsappBtn.target = '_blank'; whatsappBtn.rel = 'noopener noreferrer'; whatsappBtn.title = 'Contact us on WhatsApp'; whatsappBtn.innerHTML = ` `; // Add inline CSS styles whatsappBtn.style.cssText = ` position: fixed; right: 2rem; bottom: 100px; width: 56px; height: 56px; max-width: 56px; background-color: #25D366; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); z-index: 9999; transition: all 0.3s ease; text-decoration: none; overflow: hidden; box-sizing: border-box; `; // Add hover effect whatsappBtn.onmouseenter = function() { this.style.transform = 'scale(1.1)'; this.style.boxShadow = '0 6px 16px rgba(0, 0, 0, 0.2)'; }; whatsappBtn.onmouseleave = function() { this.style.transform = 'scale(1)'; this.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.15)'; }; // Add to the document document.body.appendChild(whatsappBtn); // Optional: Add a pulse animation const style = document.createElement('style'); style.textContent = ` @keyframes whatsappPulse { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } } `; document.head.appendChild(style); // Add pulse animation on load setTimeout(() => { whatsappBtn.style.animation = 'whatsappPulse 2s infinite'; }, 1000); })();