function addBlog() {
const targetElement = document.querySelector("nav#mobile-menu li.links");
if (targetElement) {
console.log(targetElement)
const blogLink = `
';
var q = null, a = '';
function flush() {
if (q !== null && a) {
var pq = plain(q), pa = plain(a);
if (!faqSeen[pq]) {
faqSeen[pq] = true;
faqData.push({ question: pq, answer: pa });
}
html += '
' + linkify(q) + '
' + linkify(a) + '
';
}
q = null;
a = '';
}
lines.forEach(function (raw) {
var line = raw.trim();
if (!line) return;
if (/^س\s*[::]/.test(line)) {
flush();
q = line.replace(/^س\s*[::]\s*/, '');
} else if (/^ج\s*[::]/.test(line)) {
a = line.replace(/^ج\s*[::]\s*/, '');
} else if (q !== null) {
a += (a ? ' ' : '') + line;
}
});
flush();
return html + '
';
}
function updateSchema() {
var old = document.getElementById('faq-schema');
if (old) old.remove();
if (!faqData.length) return;
var s = document.createElement('script');
s.id = 'faq-schema';
s.type = 'application/ld+json';
s.text = JSON.stringify({
'@context': 'https://schema.org',
'@type': 'FAQPage',
'mainEntity': faqData.map(function (item) {
return {
'@type': 'Question',
'name': item.question,
'acceptedAnswer': { '@type': 'Answer', 'text': item.answer }
};
})
});
document.head.appendChild(s);
}
function run() {
if (busy) return;
var body = document.body.textContent;
if (body.indexOf(TABLE_START) === -1 && body.indexOf(FAQ_START) === -1) return;
busy = true;
try {
findContainers(TABLE_START, TABLE_END).forEach(function (el) {
var n = el.innerHTML.replace(tableRe, function (m, c) { return buildTable(c); });
if (n !== el.innerHTML) el.innerHTML = n;
});
var before = faqData.length;
findContainers(FAQ_START, FAQ_END).forEach(function (el) {
var n = el.innerHTML.replace(faqRe, function (m, c) { return buildFaq(c); });
if (n !== el.innerHTML) el.innerHTML = n;
});
if (faqData.length !== before) updateSchema();
} finally {
setTimeout(function () { busy = false; }, 0);
}
}
function start() {
run();
[500, 1500, 3000].forEach(function (t) { setTimeout(run, t); });
var timer;
new MutationObserver(function () {
if (busy) return;
clearTimeout(timer);
timer = setTimeout(run, 300);
}).observe(document.body, { childList: true, subtree: true });
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', start);
} else {
start();
}
})();