کتاب مقدس آنلاین: تفاوت میان نسخهها
ظاهر
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
| خط ۴۴۷: | خط ۴۴۷: | ||
} | } | ||
// تابع برای | // تابع برای مدیریت کلیک روی لینکهای داخل iframe | ||
function | function handleIframeLinks(iframe) { | ||
if (!iframe) return; | if (!iframe) return; | ||
| خط ۴۵۹: | خط ۴۵۹: | ||
if (link.href && | if (link.href && | ||
!link.href.startsWith('javascript:') && | !link.href.startsWith('javascript:') && | ||
!link.href.startsWith('#')) { | !link.href.startsWith('#') && | ||
// برای | link.href.includes('pediabible.com')) { | ||
link. | |||
// اضافه کردن event listener برای کلیک | |||
link.addEventListener('click', function(e) { | |||
e.preventDefault(); | |||
// استخراج عنوان صفحه از URL | |||
const url = new URL(link.href); | |||
const pageTitle = url.searchParams.get('title'); | |||
if (pageTitle) { | |||
// بارگذاری محتوای صفحه جدید در iframe با action=render | |||
const newContentUrl = `https://www.pediabible.com/index.php?title=${encodeURIComponent(pageTitle)}&action=render`; | |||
iframe.src = newContentUrl; | |||
// بهروزرسانی عنوان | |||
const chapterTitle = document.getElementById('chapter-title'); | |||
chapterTitle.textContent = `صفحه: ${decodeURIComponent(pageTitle)}`; | |||
} | |||
}); | |||
} | } | ||
}); | }); | ||
| خط ۸۰۰: | خط ۸۱۷: | ||
wikiPageLink.style.display = 'flex'; | wikiPageLink.style.display = 'flex'; | ||
// اضافه کردن ویژگی | // اضافه کردن ویژگی مدیریت لینکها به iframe | ||
const iframe = document.getElementById('content-iframe'); | const iframe = document.getElementById('content-iframe'); | ||
handleIframeLinks(iframe); | |||
updateNavigationButtons(); | updateNavigationButtons(); | ||
} | } | ||