پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۶: خط ۶:
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
     <style>
     <style>
        /* استایل‌ها همانند قبل */
         :root {
         :root {
             --primary-color: #2c3e50;
             --primary-color: #2c3e50;
خط ۳۱: خط ۳۰:
             padding: 0;
             padding: 0;
             margin: 0;
             margin: 0;
        }
       
        /* مخفی کردن هدرهای اضافی ویکی */
        body > header:first-child,
        .wiki-header,
        .mw-header,
        #mw-header,
        #header,
        .header {
            display: none !important;
         }
         }
          
          
خط ۳۴۹: خط ۳۵۸:
         }
         }


        /* استایل برای حالت انتخاب نشده */
         .placeholder {
         .placeholder {
             display: flex;
             display: flex;
خط ۳۶۵: خط ۳۷۵:
         }
         }


        /* استایل برای راست‌چین کامل */
         option {
         option {
             direction: rtl;
             direction: rtl;
             text-align: right;
             text-align: right;
        }
       
        /* استایل برای محتوای ویکی */
        .wiki-content {
            line-height: 1.8;
            font-size: 1.1rem;
            padding: 20px;
        }
       
        .wiki-content h1,
        .wiki-content h2,
        .wiki-content h3 {
            color: var(--primary-color);
            margin: 25px 0 15px 0;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 8px;
        }
       
        .wiki-content p {
            margin-bottom: 15px;
            text-align: justify;
        }
       
        .wiki-content .verse {
            margin: 10px 0;
            padding-right: 15px;
            border-right: 3px solid var(--border-color);
         }
         }
     </style>
     </style>
خط ۴۲۴: خط ۴۰۸:
         ];
         ];


        // تابع بررسی مجاز بودن دامنه
         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;
             }
             }
              
              
             return ALLOWED_DOMAINS.some(domain => {
             const isAllowed = ALLOWED_DOMAINS.some(domain => {
                 return currentDomain === domain || currentDomain.endsWith('.' + domain);
                 const match = currentDomain === domain || currentDomain.endsWith('.' + domain);
                if (match) {
                    console.log(`✅ دامنه ${currentDomain} مجاز است`);
                }
                return match;
             });
             });
           
            if (!isAllowed) {
                console.log(`❌ دامنه ${currentDomain} غیرمجاز است`);
            }
           
            return isAllowed;
         }
         }


        // تابع نمایش پیام دسترسی غیرمجاز
         function showAccessDenied() {
         function showAccessDenied() {
             const wrapper = document.getElementById('content-wrapper');
             const wrapper = document.getElementById('content-wrapper');
خط ۴۴۶: خط ۴۴۵:
                 </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: "کتاب مکاشفه " }
             ]
             ]
         };
         };


        // 🔧 برنامه اصلی کتاب مقدس
         function initializeBibleApp() {
         function initializeBibleApp() {
             const wrapper = document.getElementById('content-wrapper');
             const wrapper = document.getElementById('content-wrapper');
              
              
            // ایجاد ساختار HTML برنامه
             wrapper.innerHTML = `
             wrapper.innerHTML = `
                 <div class="selector-container">
                 <div class="selector-container">
خط ۵۹۳: خط ۶۰۹:
             `;
             `;


            // داده‌های ترجمه‌های مختلف
             const translations = {
             const translations = {
                 'old': {
                 'old': {
                     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}`;
                     }
                     }
                 },
                 },
خط ۶۱۲: خط ۶۳۱:
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     getPageTitle: function(bookDisplayName, chapter) {
                     getPageTitle: function(bookDisplayName, chapter) {
                         return bookDisplayName + ' مژده فصل ' + chapter;
                         return `${bookDisplayName} مژده فصل ${chapter}`;
                     }
                     }
                 },
                 },
خط ۶۱۹: خط ۶۳۸:
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     baseUrl: 'https://www.pediabible.com/index.php?title=',
                     getPageTitle: function(bookDisplayName, chapter) {
                     getPageTitle: function(bookDisplayName, chapter) {
                         return bookDisplayName + ' دانشنامه فصل ' + chapter;
                         return `${bookDisplayName} دانشنامه فصل ${chapter}`;
                     }
                     }
                 }
                 }
             };
             };


            // عناصر DOM
             const translationSelect = document.getElementById('translation-select');
             const translationSelect = document.getElementById('translation-select');
             const testamentSelect = document.getElementById('testament-select');
             const testamentSelect = document.getElementById('testament-select');
خط ۶۳۴: خط ۶۵۴:
             const wikiPageLink = document.getElementById('wiki-page-link');
             const wikiPageLink = document.getElementById('wiki-page-link');


            // متغیرهای وضعیت فعلی
             let currentTranslation = '';
             let currentTranslation = '';
             let currentTestament = '';
             let currentTestament = '';
خط ۶۳۹: خط ۶۶۰:
             let currentChapter = 1;
             let currentChapter = 1;


            // رویداد تغییر ترجمه
             translationSelect.addEventListener('change', function() {
             translationSelect.addEventListener('change', function() {
                 currentTranslation = this.value;
                 currentTranslation = this.value;
خط ۶۵۵: خط ۶۷۷:
             });
             });


            // رویداد تغییر عهد
             testamentSelect.addEventListener('change', function() {
             testamentSelect.addEventListener('change', function() {
                 currentTestament = this.value;
                 currentTestament = this.value;
خط ۶۶۲: خط ۶۸۵:
                     bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                     bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                      
                      
                     bibleBooks[currentTestament].forEach(function(book, index) {
                     bibleBooks[currentTestament].forEach((book, index) => {
                         const option = document.createElement('option');
                         const option = document.createElement('option');
                         option.value = index;
                         option.value = index;
خط ۶۸۱: خط ۷۰۴:
             });
             });


            // رویداد تغییر کتاب
             bookSelect.addEventListener('change', function() {
             bookSelect.addEventListener('change', function() {
                 currentBook = this.value;
                 currentBook = this.value;
خط ۶۹۴: خط ۷۱۸:
                         const option = document.createElement('option');
                         const option = document.createElement('option');
                         option.value = i;
                         option.value = i;
                         option.textContent = 'فصل ' + i;
                         option.textContent = `فصل ${i}`;
                         chapterSelect.appendChild(option);
                         chapterSelect.appendChild(option);
                     }
                     }
خط ۷۰۸: خط ۷۳۲:
             });
             });


            // رویداد تغییر فصل
             chapterSelect.addEventListener('change', function() {
             chapterSelect.addEventListener('change', function() {
                 currentChapter = parseInt(this.value);
                 currentChapter = parseInt(this.value);
خط ۷۱۸: خط ۷۴۳:
             });
             });


            // نمایش فصل با iframe - فقط محتوای اصلی
             function displayChapterWithIframe() {
             function displayChapterWithIframe() {
                 const bookIndex = parseInt(currentBook);
                 const bookIndex = parseInt(currentBook);
خط ۷۲۵: خط ۷۵۱:
                 const translationName = translations[currentTranslation].name;
                 const translationName = translations[currentTranslation].name;
                  
                  
                 chapterTitle.textContent = translationName + ' - ' + bookName + ' - فصل ' + currentChapter;
                 chapterTitle.textContent = `${translationName} - ${bookName} - فصل ${currentChapter}`;
                  
                  
                // استفاده از الگوی مناسب برای هر ترجمه
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                 const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                const contentUrl = translations[currentTranslation].baseUrl + encodeURIComponent(pageTitle) + '&action=render';
                  
                  
                 // استفاده از sandbox برای جلوگیری از اجرای JavaScript
                 // استفاده از action=render برای نمایش فقط محتوای اصلی
                const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`;
               
                 versesContainer.innerHTML = `
                 versesContainer.innerHTML = `
                     <iframe  
                     <iframe  
خط ۷۳۸: خط ۷۶۶:
                         frameborder="0"
                         frameborder="0"
                         loading="lazy"
                         loading="lazy"
                        sandbox="allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"
                         allowfullscreen>
                         allowfullscreen>
                     </iframe>
                     </iframe>
                 `;
                 `;
                  
                  
                 wikiPageLink.href = translations[currentTranslation].baseUrl + encodeURIComponent(pageTitle);
                // لینک صفحه کامل برای باز کردن در تب جدید
                 wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                 wikiPageLink.style.display = 'flex';
                 wikiPageLink.style.display = 'flex';
                 updateNavigationButtons();
                 updateNavigationButtons();
                  
                  
                 setupIframeLinkHandler();
                 // 🔄 اضافه کردن مدیریت لینک‌های داخلی
                setupSimpleLinkHandler();
             }
             }


             function setupIframeLinkHandler() {
            // 🔧 سیستم ساده مدیریت لینک‌های داخلی
             function setupSimpleLinkHandler() {
                 const iframe = document.getElementById('content-iframe');
                 const iframe = document.getElementById('content-iframe');
                  
                  
خط ۷۵۶: خط ۷۸۶:
                     try {
                     try {
                         const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                         const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
                         const links = iframeDoc.querySelectorAll('a');
                         const links = iframeDoc.querySelectorAll('a[href*="pediabible.com"]');
                          
                          
                         links.forEach(function(link) {
                         links.forEach(link => {
                            if (link.href && link.href.includes('pediabible.com')) {
                            link.onclick = function(e) {
                                link.addEventListener('click', function(e) {
                                e.preventDefault();
                                     e.preventDefault();
                                const url = new URL(this.href);
                                const titleParam = url.searchParams.get('title');
                               
                                if (titleParam) {
                                    // بارگذاری صفحه جدید در iframe
                                    const newUrl = `${translations[currentTranslation].baseUrl}${titleParam}&action=render`;
                                     iframe.src = newUrl;
                                      
                                      
                                     const url = new URL(this.href);
                                     // به‌روزرسانی لینک و عنوان
                                     const titleParam = url.searchParams.get('title');
                                     wikiPageLink.href = `${translations[currentTranslation].baseUrl}${titleParam}`;
                                   
                                    chapterTitle.textContent = `صفحه: ${decodeURIComponent(titleParam)}`;
                                    if (titleParam) {
                                 }
                                        const newUrl = translations[currentTranslation].baseUrl + titleParam + '&action=render';
                             };
                                        iframe.src = newUrl;
                                        wikiPageLink.href = translations[currentTranslation].baseUrl + titleParam;
                                        chapterTitle.textContent = 'صفحه: ' + decodeURIComponent(titleParam);
                                    }
                                 });
                             }
                         });
                         });
                     } catch (error) {
                     } catch (error) {
                         console.log('خطا در مدیریت لینک‌های iframe:', error);
                         // خطا را نادیده بگیر - به برنامه آسیب نمی‌زند
                     }
                     }
                 };
                 };
خط ۸۲۵: خط ۸۵۵:
             function resetAll() {
             function resetAll() {
                 testamentSelect.disabled = true;
                 testamentSelect.disabled = true;
                 testamentSelect.value = '';
                 testamentSelect.innerHTML = '<option value="">انتخاب عهد</option>';
                 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() {
             if (!isDomainAllowed()) {
             console.log('🚀 شروع بارگذاری با بررسی امنیتی...');
                showAccessDenied();
            loadApplication();
                return;
        });
             }
 
             initializeBibleApp();
        // 🔒 جلوگیری از دسترسی به توابع از کنسول
        Object.defineProperty(window, 'translations', {
             value: null,
            writable: false,
             configurable: false
         });
         });
     </script>
     </script>
</body>
</body>
</html>
</html>

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

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

کتاب مقدس

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