پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۷۸۶: خط ۷۸۶:
                     try {
                     try {
                         const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                         const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                         const links = iframeDoc.querySelectorAll('a[href*="pediabible.com"]');
                         const links = iframeDoc.querySelectorAll('a');
                          
                          
                         links.forEach(link => {
                         links.forEach(link => {
                             link.onclick = function(e) {
                             // بررسی تمام لینک‌ها به pediabible.com
                                e.preventDefault();
                            if (link.href && link.href.includes('pediabible.com')) {
                                const url = new URL(this.href);
                                 link.onclick = function(e) {
                                const titleParam = url.searchParams.get('title');
                                     e.preventDefault();
                                  
                                     e.stopPropagation();
                                if (titleParam) {
                                     // بارگذاری صفحه جدید در iframe
                                    const newUrl = `${translations[currentTranslation].baseUrl}${titleParam}&action=render`;
                                     iframe.src = newUrl;
                                      
                                      
                                     // به‌روزرسانی لینک و عنوان
                                     const url = new URL(this.href);
                                    wikiPageLink.href = `${translations[currentTranslation].baseUrl}${titleParam}`;
                                    let titleParam = url.searchParams.get('title');
                                    chapterTitle.textContent = `صفحه: ${decodeURIComponent(titleParam)}`;
                                   
                                 }
                                    // اگر title وجود ندارد، از مسیر استخراج کنیم
                             };
                                    if (!titleParam) {
                                        const pathParts = url.pathname.split('/');
                                        const lastPart = pathParts[pathParts.length - 1];
                                        if (lastPart === 'index.php') {
                                            titleParam = url.searchParams.get('title');
                                        } else {
                                            // استخراج عنوان از مسیر
                                            titleParam = decodeURIComponent(lastPart);
                                        }
                                    }
                                   
                                    if (titleParam) {
                                        // بارگذاری صفحه جدید در iframe با action=render
                                        const newUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(titleParam)}&action=render`;
                                        iframe.src = newUrl;
                                       
                                        // به‌روزرسانی لینک و عنوان
                                        wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(titleParam)}`;
                                        chapterTitle.textContent = `صفحه: ${decodeURIComponent(titleParam)}`;
                                    }
                                 };
                             }
                         });
                         });
                     } catch (error) {
                     } catch (error) {
                         // خطا را نادیده بگیر - به برنامه آسیب نمی‌زند
                         // خطا را نادیده بگیر - به برنامه آسیب نمی‌زند
                        console.log('خطا در مدیریت لینک‌ها:', error);
                     }
                     }
                 };
                 };

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

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

کتاب مقدس

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