document.addEventListener("DOMContentLoaded", function() {
const selectors = [
".product-details__description",
".product__description",
"#description",
".description-content",
".product__description article",
"article",
".pro-details",
"div[data-salla-product-description]",
"salla-product-details"
];
function processContent(targetElement) {
if (!targetElement || targetElement.dataset.processed) return;
let htmlContent = targetElement.innerHTML;
let isUpdated = false;
// 1. معالجة الجداول (متروكة كما هي لأنها ظبطت)
const tableRegex = /\|جدول\|([\s\S]*?)\|الجدول\|/g;
if (tableRegex.test(htmlContent)) {
htmlContent = htmlContent.replace(tableRegex, function (match, tableContent) {
const cleanText = tableContent
.replace(/
/gi, "\n")
.replace(/<\/p>/gi, "\n")
.replace(/<[^>]*>/g, "")
.replace(/ /g, " ");
const rows = cleanText.split("\n").filter(row => row.trim() !== "");
let tableHTML = '
| " + col + " | "); tableHTML += "
|---|
| " + col + " | "); tableHTML += "
' + (answer || 'لا توجد إجابة متاح حالياً.') + '