";
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 += "
" + col.trim() + "
");
tableHTML += "
";
isFirstRow = false;
} else {
tableHTML += "
";
cols.forEach(col => tableHTML += "
" + col.trim() + "
");
tableHTML += "
";
}
});
tableHTML += "
";
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 += '