پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۳۸: خط ۳۸:
         #mw-header,
         #mw-header,
         #header,
         #header,
         .header {
         .header,
        #mw-navigation,
        #mw-panel,
        #footer,
        .mw-footer {
             display: none !important;
             display: none !important;
         }
         }
خط ۴۵۵: خط ۴۵۹:
                 try {
                 try {
                     const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                     const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                   
                    // مخفی کردن هدرها و فوترها در داخل iframe
                    const elementsToHide = iframeDoc.querySelectorAll(
                        '#mw-navigation, #mw-panel, #footer, .mw-footer, .mw-header, header, .header'
                    );
                    elementsToHide.forEach(el => {
                        el.style.display = 'none';
                    });
                   
                    // اضافه کردن target="_blank" به تمام لینک‌ها
                     const links = iframeDoc.querySelectorAll('a');
                     const links = iframeDoc.querySelectorAll('a');
                   
                     links.forEach(link => {
                     links.forEach(link => {
                         if (link.href &&  
                         if (link.href &&  
                             !link.href.startsWith('javascript:') &&  
                             !link.href.startsWith('javascript:') &&  
                             !link.href.startsWith('#')) {
                             !link.href.startsWith('#')) {
                            // برای تمام لینک‌ها (داخلی و خارجی) target="_blank" اضافه کن
                             link.setAttribute('target', '_blank');
                             link.setAttribute('target', '_blank');
                             link.setAttribute('rel', 'noopener noreferrer');
                             link.setAttribute('rel', 'noopener noreferrer');
خط ۴۷۰: خط ۴۸۲:
                 } catch (error) {
                 } catch (error) {
                     console.log('⚠️ امکان دسترسی به محتوای iframe وجود ندارد (محدودیت CORS)');
                     console.log('⚠️ امکان دسترسی به محتوای iframe وجود ندارد (محدودیت CORS)');
                    // راه‌حل جایگزین: استفاده از MutationObserver برای نظارت بر تغییرات DOM
                    setupLinkInterception();
                }
            });
        }
        // راه‌حل جایگزین برای مدیریت کلیک روی لینک‌ها در صورت محدودیت CORS
        function setupLinkInterception() {
            document.addEventListener('click', function(event) {
                // اگر کلیک روی لینکی داخل iframe باشد
                if (event.target.tagName === 'A' && event.target.href) {
                    const link = event.target;
                   
                    // اگر لینک خارجی است، در پنجره جدید بازش کن
                    if (!link.href.startsWith('javascript:') &&
                        !link.href.startsWith('#')) {
                        event.preventDefault();
                        window.open(link.href, '_blank', 'noopener,noreferrer');
                    }
                 }
                 }
             });
             });
خط ۶۶۰: خط ۶۵۳:
                     name: 'ترجمه قدیم',
                     name: 'ترجمه قدیم',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                    // برای ترجمه قدیم از الگوی ساده با displayName استفاده می‌کنیم
                     getPageTitle: function(bookDisplayName, chapter) {
                     getPageTitle: function(bookDisplayName, chapter) {
                         return `${bookDisplayName} فصل ${chapter}`;
                         return `${bookDisplayName} فصل ${chapter}`;
خط ۶۶۸: خط ۶۶۰:
                     name: 'هزاره نو',
                     name: 'هزاره نو',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                    // برای ترجمه‌های جدید از displayName + نام ترجمه استفاده می‌کنیم
                     getPageTitle: function(bookDisplayName, chapter) {
                     getPageTitle: function(bookDisplayName, chapter) {
                         return `${bookDisplayName} هزاره نو فصل ${chapter}`;
                         return `${bookDisplayName} هزاره نو فصل ${chapter}`;
خط ۷۸۹: خط ۷۸۰:
             });
             });


             // نمایش فصل با iframe - فقط محتوای اصلی
             // نمایش فصل با iframe
             function displayChapterWithIframe() {
             function displayChapterWithIframe() {
                 const bookIndex = parseInt(currentBook);
                 const bookIndex = parseInt(currentBook);
خط ۸۰۲: خط ۷۹۳:
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                  
                  
                 // استفاده از action=render برای نمایش فقط محتوای اصلی
                 // ساخت URL بدون action=render
                 const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`;
                 const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                  
                  
                 versesContainer.innerHTML = `
                 versesContainer.innerHTML = `
خط ۸۱۷: خط ۸۰۸:
                  
                  
                 // لینک صفحه کامل برای باز کردن در تب جدید
                 // لینک صفحه کامل برای باز کردن در تب جدید
                 wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                 wikiPageLink.href = contentUrl;
                 wikiPageLink.style.display = 'flex';
                 wikiPageLink.style.display = 'flex';
                  
                  

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

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

کتاب مقدس

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