پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۳۰: خط ۳۰:
             padding: 0;
             padding: 0;
             margin: 0;
             margin: 0;
        }
       
        /* مخفی کردن هدرهای اضافی ویکی */
        body > header:first-child,
        .wiki-header,
        .mw-header,
        #mw-header,
        #header,
        .header {
            display: none !important;
         }
         }
          
          
خط ۱۸۳: خط ۱۷۳:
         .content-display {
         .content-display {
             width: 100%;
             width: 100%;
             height: 650px;
             min-height: 600px;
            max-height: 700px;
            overflow-y: auto;
             border: 1px solid var(--border-color);
             border: 1px solid var(--border-color);
             border-radius: 6px;
             border-radius: 6px;
             background: white;
             background: white;
            padding: 20px;
            line-height: 2;
            font-size: 1.1rem;
        }
       
        .content-display .verse {
            margin-bottom: 15px;
            padding-right: 15px;
            border-right: 3px solid var(--border-color);
        }
       
        .content-display .verse-number {
            background-color: var(--accent-color);
            color: white;
            padding: 2px 8px;
            border-radius: 50%;
            font-size: 0.8rem;
            margin-left: 5px;
        }
       
        .content-display a {
            color: var(--secondary-color);
            text-decoration: none;
            border-bottom: 1px dotted var(--secondary-color);
            transition: all 0.3s;
        }
       
        .content-display a:hover {
            color: var(--accent-color);
            border-bottom: 1px solid var(--accent-color);
        }
       
        .loading {
            text-align: center;
            padding: 40px;
            color: var(--accent-color);
        }
       
        .loading i {
            font-size: 2rem;
            margin-bottom: 15px;
         }
         }
          
          
خط ۳۲۰: خط ۳۵۳:
              
              
             .content-display {
             .content-display {
                 height: 500px;
                 min-height: 400px;
                max-height: 500px;
                padding: 15px;
             }
             }
              
              
خط ۳۳۶: خط ۳۷۱:
         @media (max-width: 480px) {
         @media (max-width: 480px) {
             .content-display {
             .content-display {
                 height: 450px;
                 min-height: 350px;
                max-height: 450px;
             }
             }
              
              
خط ۴۱۱: خط ۴۴۷:
         function isDomainAllowed() {
         function isDomainAllowed() {
             const currentDomain = window.location.hostname;
             const currentDomain = window.location.hostname;
            console.log('🔍 بررسی دامنه:', currentDomain);
              
              
            // اگر روی فایل محلی هستیم، اجازه بده
             if (!currentDomain || currentDomain === '' || currentDomain === 'null') {
             if (!currentDomain || currentDomain === '' || currentDomain === 'null') {
                console.log('✅ فایل محلی - مجاز');
                 return true;
                 return true;
             }
             }
              
              
             const isAllowed = ALLOWED_DOMAINS.some(domain => {
             return ALLOWED_DOMAINS.some(domain => {
                 const match = currentDomain === domain || currentDomain.endsWith('.' + domain);
                 return currentDomain === domain || currentDomain.endsWith('.' + domain);
                if (match) {
                    console.log(`✅ دامنه ${currentDomain} مجاز است`);
                }
                return match;
             });
             });
           
            if (!isAllowed) {
                console.log(`❌ دامنه ${currentDomain} غیرمجاز است`);
            }
           
            return isAllowed;
         }
         }


خط ۴۴۵: خط ۴۶۸:
                 </div>
                 </div>
             `;
             `;
        }
        // تابع اصلی بارگذاری برنامه
        function loadApplication() {
            console.log('🚀 شروع بارگذاری با بررسی امنیتی...');
           
            if (!isDomainAllowed()) {
                console.log('❌ دسترسی غیرمجاز - نمایش پیام خطا');
                showAccessDenied();
                return;
            }
            console.log('✅ دامنه مجاز - بارگذاری برنامه اصلی');
            // اگر دامنه مجاز باشد، برنامه اصلی بارگذاری می‌شود
            initializeBibleApp();
         }
         }


خط ۵۱۰: خط ۵۱۸:
                 { name: "لوقا", chapters: 24, displayName: "انجیل به قلم لوقا" },
                 { name: "لوقا", chapters: 24, displayName: "انجیل به قلم لوقا" },
                 { name: "یوحنا", chapters: 21, displayName: "انجیل به قلم یوحنا" },
                 { name: "یوحنا", chapters: 21, displayName: "انجیل به قلم یوحنا" },
                 { name: "اعمال ", chapters: 28, displayName: "اعمال " },
                 { name: "اعمال", chapters: 28, displayName: "اعمال" },
                 { name: "رومیان", chapters: 16, displayName: "رساله به رومیان" },
                 { name: "رومیان", chapters: 16, displayName: "رساله به رومیان" },
                 { name: "اول قرنتیان", chapters: 16, displayName: "رساله اول به قرنتیان" },
                 { name: "اول قرنتیان", chapters: 16, displayName: "رساله اول به قرنتیان" },
خط ۵۳۲: خط ۵۴۰:
                 { name: "سوم یوحنا", chapters: 1, displayName: "رساله سوم یوحنا" },
                 { name: "سوم یوحنا", chapters: 1, displayName: "رساله سوم یوحنا" },
                 { name: "یهودا", chapters: 1, displayName: "رساله یهودا" },
                 { name: "یهودا", chapters: 1, displayName: "رساله یهودا" },
                 { name: "کتاب مکاشفه", chapters: 22, displayName: "کتاب مکاشفه " }
                 { name: "کتاب مکاشفه", chapters: 22, displayName: "کتاب مکاشفه" }
             ]
             ]
         };
         };
خط ۶۱۴: خط ۶۲۲:
                     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}`;
خط ۷۳۷: خط ۷۴۳:
                  
                  
                 if (currentChapter) {
                 if (currentChapter) {
                     displayChapterWithIframe();
                     displayChapterContent();
                 } else {
                 } else {
                     resetContent();
                     resetContent();
خط ۷۴۳: خط ۷۴۹:
             });
             });


             // نمایش فصل با iframe - فقط محتوای اصلی
             // نمایش فصل با Fetch API
             function displayChapterWithIframe() {
             async function displayChapterContent() {
                 const bookIndex = parseInt(currentBook);
                 const bookIndex = parseInt(currentBook);
                 const bookData = bibleBooks[currentTestament][bookIndex];
                 const bookData = bibleBooks[currentTestament][bookIndex];
خط ۷۵۲: خط ۷۵۸:
                  
                  
                 chapterTitle.textContent = `${translationName} - ${bookName} - فصل ${currentChapter}`;
                 chapterTitle.textContent = `${translationName} - ${bookName} - فصل ${currentChapter}`;
               
                // نمایش loading
                versesContainer.innerHTML = `
                    <div class="loading">
                        <i class="fas fa-spinner fa-spin"></i>
                        <p>در حال بارگذاری محتوا...</p>
                    </div>
                `;
                  
                  
                 // استفاده از الگوی مناسب برای هر ترجمه
                 // استفاده از الگوی مناسب برای هر ترجمه
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                  
                  
                 // استفاده از action=render برای نمایش فقط محتوای اصلی
                 // استفاده از action=render برای دریافت فقط محتوای اصلی
                 const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`;
                 const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`;
                  
                  
                 versesContainer.innerHTML = `
                 try {
                    <iframe
                    const response = await fetch(contentUrl);
                        id="content-iframe"
                    const html = await response.text();
                        src="${contentUrl}"
                   
                         class="content-display"
                    // پردازش HTML و استخراج محتوای اصلی
                        frameborder="0"
                    const processedContent = processWikiContent(html);
                        loading="lazy"
                   
                        allowfullscreen>
                    // نمایش محتوا
                    </iframe>
                    versesContainer.innerHTML = `
                `;
                        <div class="content-display">
                            ${processedContent}
                        </div>
                    `;
                   
                    // اضافه کردن event listener به لینک‌ها
                    setupLinkHandlers();
                   
                } catch (error) {
                    versesContainer.innerHTML = `
                         <div class="access-denied">
                            <h3><i class="fas fa-exclamation-triangle"></i> خطا در بارگذاری</h3>
                            <p>مشکلی در بارگذاری محتوا پیش آمده است.</p>
                            <p>لطفاً دوباره تلاش کنید.</p>
                        </div>
                    `;
                }
                  
                  
                 // لینک صفحه کامل برای باز کردن در تب جدید
                 // لینک صفحه کامل برای باز کردن در تب جدید
خط ۷۷۴: خط ۸۰۴:
                 wikiPageLink.style.display = 'flex';
                 wikiPageLink.style.display = 'flex';
                 updateNavigationButtons();
                 updateNavigationButtons();
            }
            // پردازش محتوای ویکی و حذف المان‌های اضافی
            function processWikiContent(html) {
                const tempDiv = document.createElement('div');
                tempDiv.innerHTML = html;
               
                // حذف هدرها و منوها
                const elementsToRemove = tempDiv.querySelectorAll(
                    'header, nav, .mw-header, .wiki-header, .header, #header, .navigation, .nav, .mw-nav, #mw-navigation'
                );
                elementsToRemove.forEach(el => el.remove());
               
                // حذف اسکریپت‌ها
                const scripts = tempDiv.querySelectorAll('script');
                scripts.forEach(script => script.remove());
               
                // حذف استایل‌ها
                const styles = tempDiv.querySelectorAll('style, link[rel="stylesheet"]');
                styles.forEach(style => style.remove());
               
                // بهبود لینک‌ها - تبدیل به لینک‌های داخلی
                const links = tempDiv.querySelectorAll('a[href*="pediabible.com"]');
                links.forEach(link => {
                    const url = new URL(link.href);
                    const titleParam = url.searchParams.get('title');
                    if (titleParam) {
                        link.setAttribute('data-wiki-title', titleParam);
                        link.classList.add('wiki-internal-link');
                    }
                });
                  
                  
                 // 🔄 اضافه کردن مدیریت لینک‌های داخلی
                 return tempDiv.innerHTML;
                setupSimpleLinkHandler();
             }
             }


             // 🔧 سیستم ساده مدیریت لینک‌های داخلی
             // تنظیم event handler برای لینک‌ها
             function setupSimpleLinkHandler() {
             function setupLinkHandlers() {
                 const iframe = document.getElementById('content-iframe');
                 const links = versesContainer.querySelectorAll('.wiki-internal-link');
                  
                  
                 iframe.onload = function() {
                 links.forEach(link => {
                    try {
                    link.addEventListener('click', function(e) {
                         const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                         e.preventDefault();
                         const links = iframeDoc.querySelectorAll('a');
                         const title = this.getAttribute('data-wiki-title');
                          
                          
                         links.forEach(link => {
                         if (title) {
                             // بررسی تمام لینک‌ها به pediabible.com
                             // بارگذاری صفحه جدید
                             if (link.href && link.href.includes('pediabible.com')) {
                             loadWikiPage(title);
                                link.onclick = function(e) {
                        }
                                    e.preventDefault();
                    });
                                    e.stopPropagation();
                });
                                   
            }
                                    const url = new URL(this.href);
 
                                    let titleParam = url.searchParams.get('title');
            // بارگذاری صفحه ویکی
                                   
            async function loadWikiPage(title) {
                                    // اگر title وجود ندارد، از مسیر استخراج کنیم
                chapterTitle.textContent = `صفحه: ${decodeURIComponent(title)}`;
                                    if (!titleParam) {
               
                                        const pathParts = url.pathname.split('/');
                // نمایش loading
                                        const lastPart = pathParts[pathParts.length - 1];
                versesContainer.innerHTML = `
                                        if (lastPart === 'index.php') {
                    <div class="loading">
                                            titleParam = url.searchParams.get('title');
                        <i class="fas fa-spinner fa-spin"></i>
                                        } else {
                        <p>در حال بارگذاری محتوا...</p>
                                            // استخراج عنوان از مسیر
                    </div>
                                            titleParam = decodeURIComponent(lastPart);
                `;
                                        }
               
                                    }
                const contentUrl = `${translations[currentTranslation].baseUrl}${title}&action=render`;
                                   
               
                                    if (titleParam) {
                try {
                                        // بارگذاری صفحه جدید در iframe با action=render
                    const response = await fetch(contentUrl);
                                        const newUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(titleParam)}&action=render`;
                    const html = await response.text();
                                        iframe.src = newUrl;
                   
                                       
                    // پردازش HTML و استخراج محتوای اصلی
                                        // به‌روزرسانی لینک و عنوان
                    const processedContent = processWikiContent(html);
                                        wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(titleParam)}`;
                   
                                        chapterTitle.textContent = `صفحه: ${decodeURIComponent(titleParam)}`;
                    // نمایش محتوا
                                    }
                    versesContainer.innerHTML = `
                                };
                        <div class="content-display">
                            }
                            ${processedContent}
                        });
                        </div>
                     } catch (error) {
                    `;
                         // خطا را نادیده بگیر - به برنامه آسیب نمی‌زند
                   
                         console.log('خطا در مدیریت لینک‌ها:', error);
                    // اضافه کردن event listener به لینک‌ها
                    }
                    setupLinkHandlers();
                 };
                      
                } catch (error) {
                    versesContainer.innerHTML = `
                         <div class="access-denied">
                            <h3><i class="fas fa-exclamation-triangle"></i> خطا در بارگذاری</h3>
                            <p>مشکلی در بارگذاری محتوا پیش آمده است.</p>
                         </div>
                    `;
                }
                  
                // به‌روزرسانی لینک صفحه کامل
                wikiPageLink.href = `${translations[currentTranslation].baseUrl}${title}`;
             }
             }


خط ۸۴۱: خط ۹۱۲:
                     currentChapter--;
                     currentChapter--;
                     chapterSelect.value = currentChapter;
                     chapterSelect.value = currentChapter;
                     displayChapterWithIframe();
                     displayChapterContent();
                 }
                 }
             });
             });
خط ۸۵۲: خط ۹۲۳:
                     currentChapter++;
                     currentChapter++;
                     chapterSelect.value = currentChapter;
                     chapterSelect.value = currentChapter;
                     displayChapterWithIframe();
                     displayChapterContent();
                 }
                 }
             });
             });
خط ۸۷۳: خط ۹۴۴:
             function resetAll() {
             function resetAll() {
                 testamentSelect.disabled = true;
                 testamentSelect.disabled = true;
                 testamentSelect.innerHTML = '<option value="">انتخاب عهد</option>';
                 testamentSelect.value = '';
                 bookSelect.disabled = true;
                 bookSelect.disabled = true;
                 bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                 bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
خط ۸۸۰: خط ۹۵۱:
                 resetContent();
                 resetContent();
             }
             }
            console.log('✅ برنامه کتاب مقدس روی دامنه مجاز بارگذاری شد');
         }
         }


         // 🔒 شروع برنامه با بررسی امنیتی
         // شروع برنامه
         document.addEventListener('DOMContentLoaded', function() {
         document.addEventListener('DOMContentLoaded', function() {
             console.log('🚀 شروع بارگذاری با بررسی امنیتی...');
             if (!isDomainAllowed()) {
            loadApplication();
                showAccessDenied();
        });
                return;
 
             }
        // 🔒 جلوگیری از دسترسی به توابع از کنسول
             initializeBibleApp();
        Object.defineProperty(window, 'translations', {
             value: null,
             writable: false,
            configurable: false
         });
         });
     </script>
     </script>
</body>
</body>
</html>
</html>

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

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

کتاب مقدس

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