کتاب مقدس آنلاین
ظاهر
function setupIframeLinkHandler() {
const iframe = document.getElementById('content-iframe');
iframe.onload = function() {
try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const links = iframeDoc.querySelectorAll('a');
links.forEach(link => {
if (link.href && link.href.includes('pediabible.com')) {
link.addEventListener('click', function(e) {
e.preventDefault();
const url = new URL(this.href);
const titleParam = url.searchParams.get('title');
if (titleParam) {
const newUrl = `${translations[currentTranslation].baseUrl}${titleParam}&action=render`;
iframe.src = newUrl;
wikiPageLink.href = `${translations[currentTranslation].baseUrl}${titleParam}`;
chapterTitle.textContent = `صفحه: ${decodeURIComponent(titleParam)}`;
}
});
}
});
} catch (error) {
console.log('⚠️ خطا در مدیریت لینکهای iframe:', error);
}
};
}