پرش به محتوا

کتاب مقدس آنلاین: تفاوت میان نسخه‌ها

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۴۴۵: خط ۴۴۵:
                 </div>
                 </div>
             `;
             `;
        }
        // تابع برای مدیریت کلیک روی لینک‌های داخل iframe
        function handleIframeLinks(iframe) {
            if (!iframe) return;
           
            iframe.onload = function() {
                try {
                    const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                    const links = iframeDoc.querySelectorAll('a');
                   
                    links.forEach(link => {
                        if (link.href &&
                            !link.href.startsWith('javascript:') &&
                            !link.href.startsWith('#') &&
                            link.href.includes('pediabible.com')) {
                           
                            // اضافه کردن 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)}`;
                                }
                            });
                        }
                    });
                   
                    console.log(`✅ ${links.length} لینک پردازش شد`);
                } catch (error) {
                    console.log('⚠️ امکان دسترسی به محتوای iframe وجود ندارد (محدودیت CORS)');
                }
            };
         }
         }


خط ۸۱۶: خط ۷۷۳:
                 wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                 wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                 wikiPageLink.style.display = 'flex';
                 wikiPageLink.style.display = 'flex';
               
                // اضافه کردن ویژگی مدیریت لینک‌ها به iframe
                const iframe = document.getElementById('content-iframe');
                handleIframeLinks(iframe);
                 updateNavigationButtons();
                 updateNavigationButtons();
             }
             }
خط ۸۷۷: خط ۸۳۰:
             console.log('✅ برنامه کتاب مقدس روی دامنه مجاز بارگذاری شد');
             console.log('✅ برنامه کتاب مقدس روی دامنه مجاز بارگذاری شد');
         }
         }
function interceptInternalLinks(iframe) {
    try {
        const doc = iframe.contentDocument || iframe.contentWindow.document;
        const links = doc.querySelectorAll('a[href*="title="]');
        links.forEach(link => {
            const href = link.getAttribute('href');
            if (!href || href.startsWith('http') && !href.includes('pediabible.com')) return;
            link.addEventListener('click', function(e) {
                e.preventDefault();
                let url;
                try {
                    url = href.startsWith('http') ? new URL(href) : new URL(href, location.origin);
                } catch {
                    return;
                }
                const title = url.searchParams.get('title') || decodeURIComponent(url.pathname.split('/').pop());
                if (title) {
                    const renderUrl = `${location.origin}/index.php?title=${encodeURIComponent(title)}&action=render`;
                    iframe.src = renderUrl;
                    document.getElementById('chapter-title').textContent = `مطلب: ${decodeURIComponent(title)}`;
                }
            });
        });
    } catch (err) {
        console.warn('دسترسی به iframe محدود شد:', err.message);
    }
}


         // 🔒 شروع برنامه با بررسی امنیتی
         // 🔒 شروع برنامه با بررسی امنیتی

نسخهٔ ‏۹ اکتبر ۲۰۲۵، ساعت ۱۶:۲۸

کتاب مقدس - مطالعه آنلاین

کتاب مقدس

مطالعه کتاب مقدس با ترجمه‌های مختلف