پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۱۷۹: خط ۱۷۹:
             border-radius: 6px;
             border-radius: 6px;
             background: white;
             background: white;
             padding: 20px;
             padding: 25px;
             line-height: 2;
             line-height: 2;
             font-size: 1.1rem;
             font-size: 1.1rem;
خط ۱۸۷: خط ۱۸۷:
             margin-bottom: 15px;
             margin-bottom: 15px;
             padding-right: 15px;
             padding-right: 15px;
            border-right: 3px solid var(--border-color);
         }
         }
          
          
خط ۲۰۴: خط ۲۰۳:
             border-bottom: 1px dotted var(--secondary-color);
             border-bottom: 1px dotted var(--secondary-color);
             transition: all 0.3s;
             transition: all 0.3s;
            cursor: pointer;
         }
         }
          
          
خط ۳۶۹: خط ۳۶۹:
         }
         }


        @media (max-width: 480px) {
            .content-display {
                min-height: 350px;
                max-height: 450px;
            }
           
            .nav-btn, .wiki-link {
                padding: 10px 15px;
                font-size: 0.9rem;
            }
           
            .instructions {
                padding: 30px 15px;
                font-size: 1rem;
            }
           
            .app-header {
                padding: 10px 12px;
            }
           
            .app-header h1 {
                font-size: 1.3rem;
            }
        }
        /* استایل برای حالت انتخاب نشده */
         .placeholder {
         .placeholder {
             display: flex;
             display: flex;
خط ۴۱۱: خط ۳۸۵:
         }
         }


        /* استایل برای راست‌چین کامل */
         option {
         option {
             direction: rtl;
             direction: rtl;
خط ۴۴۴: خط ۴۱۷:
         ];
         ];


        // تابع بررسی مجاز بودن دامنه
         function isDomainAllowed() {
         function isDomainAllowed() {
             const currentDomain = window.location.hostname;
             const currentDomain = window.location.hostname;
           
             if (!currentDomain || currentDomain === '' || currentDomain === 'null') {
             if (!currentDomain || currentDomain === '' || currentDomain === 'null') {
                 return true;
                 return true;
             }
             }
           
             return ALLOWED_DOMAINS.some(domain => {
             return ALLOWED_DOMAINS.some(domain => {
                 return currentDomain === domain || currentDomain.endsWith('.' + domain);
                 return currentDomain === domain || currentDomain.endsWith('.' + domain);
خط ۴۵۷: خط ۴۲۷:
         }
         }


        // تابع نمایش پیام دسترسی غیرمجاز
         function showAccessDenied() {
         function showAccessDenied() {
             const wrapper = document.getElementById('content-wrapper');
             const wrapper = document.getElementById('content-wrapper');
خط ۴۶۴: خط ۴۳۳:
                     <h3><i class="fas fa-ban"></i> دسترسی محدود شده</h3>
                     <h3><i class="fas fa-ban"></i> دسترسی محدود شده</h3>
                     <p>این صفحه فقط بر روی دامنه <strong>pediabible.com</strong> قابل دسترسی است.</p>
                     <p>این صفحه فقط بر روی دامنه <strong>pediabible.com</strong> قابل دسترسی است.</p>
                    <p>دامنه فعلی: <code>${window.location.hostname}</code></p>
                     <p>لطفاً از <a href="https://www.pediabible.com" style="color: #721c24; text-decoration: underline;">سایت اصلی</a> بازدید کنید.</p>
                     <p>لطفاً از <a href="https://www.pediabible.com" style="color: #721c24; text-decoration: underline;">سایت اصلی</a> بازدید کنید.</p>
                 </div>
                 </div>
خط ۵۴۸: خط ۵۱۶:
             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': {
خط ۶۴۹: خط ۶۱۵:
             };
             };


            // عناصر 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.addEventListener('change', function() {
             bookSelect.addEventListener('change', function() {
                 currentBook = this.value;
                 currentBook = this.value;
خط ۷۳۸: خط ۶۹۹:
             });
             });


            // رویداد تغییر فصل
             chapterSelect.addEventListener('change', function() {
             chapterSelect.addEventListener('change', function() {
                 currentChapter = parseInt(this.value);
                 currentChapter = parseInt(this.value);
                  
                  
                 if (currentChapter) {
                 if (currentChapter) {
                     displayChapterContent();
                     loadContent();
                 } else {
                 } else {
                     resetContent();
                     resetContent();
خط ۷۴۹: خط ۷۰۹:
             });
             });


             // نمایش فصل با Fetch API
             // تابع اصلی برای بارگذاری محتوا
             async function displayChapterContent() {
             async function loadContent(pageTitle = null) {
                 const bookIndex = parseInt(currentBook);
                 let title;
                const bookData = bibleBooks[currentTestament][bookIndex];
                let displayTitle;
                const bookName = bookData.name;
 
                const bookDisplayName = bookData.displayName;
                if (pageTitle) {
                const translationName = translations[currentTranslation].name;
                    // اگر صفحه خاصی درخواست شده (مثل اسحاق)
               
                    title = pageTitle;
                chapterTitle.textContent = `${translationName} - ${bookName} - فصل ${currentChapter}`;
                    displayTitle = decodeURIComponent(pageTitle);
                  
                } else {
                    // اگر فصل کتاب درخواست شده
                    const bookIndex = parseInt(currentBook);
                    const bookData = bibleBooks[currentTestament][bookIndex];
                    const bookName = bookData.name;
                    const bookDisplayName = bookData.displayName;
                    const translationName = translations[currentTranslation].name;
                   
                    title = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
                    displayTitle = `${translationName} - ${bookName} - فصل ${currentChapter}`;
                 }
 
                chapterTitle.textContent = displayTitle;
 
                 // نمایش loading
                 // نمایش loading
                 versesContainer.innerHTML = `
                 versesContainer.innerHTML = `
خط ۷۶۶: خط ۷۳۹:
                     </div>
                     </div>
                 `;
                 `;
               
 
                // استفاده از الگوی مناسب برای هر ترجمه
                const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter);
               
                 // استفاده از action=render برای دریافت فقط محتوای اصلی
                 // استفاده از action=render برای دریافت فقط محتوای اصلی
                 const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`;
                 const contentUrl = `https://www.pediabible.com/index.php?title=${encodeURIComponent(title)}&action=render`;
               
 
                 try {
                 try {
                     const response = await fetch(contentUrl);
                     const response = await fetch(contentUrl);
                     const html = await response.text();
                     const html = await response.text();
                      
                      
                     // پردازش HTML و استخراج محتوای اصلی
                     // پردازش HTML و استخراج فقط محتوای اصلی
                     const processedContent = processWikiContent(html);
                     const processedContent = processContent(html);
                      
                      
                     // نمایش محتوا
                     // نمایش محتوا در container
                     versesContainer.innerHTML = `
                     versesContainer.innerHTML = `
                         <div class="content-display">
                         <div class="content-display">
خط ۷۸۶: خط ۷۵۶:
                         </div>
                         </div>
                     `;
                     `;
                   
 
                     // اضافه کردن event listener به لینک‌ها
                     // تنظیم event listener برای تمام لینک‌های داخلی
                     setupLinkHandlers();
                     setupInternalLinks();
                   
 
                 } catch (error) {
                 } catch (error) {
                     versesContainer.innerHTML = `
                     versesContainer.innerHTML = `
خط ۷۹۵: خط ۷۶۵:
                             <h3><i class="fas fa-exclamation-triangle"></i> خطا در بارگذاری</h3>
                             <h3><i class="fas fa-exclamation-triangle"></i> خطا در بارگذاری</h3>
                             <p>مشکلی در بارگذاری محتوا پیش آمده است.</p>
                             <p>مشکلی در بارگذاری محتوا پیش آمده است.</p>
                            <p>لطفاً دوباره تلاش کنید.</p>
                         </div>
                         </div>
                     `;
                     `;
                 }
                 }
                // لینک صفحه کامل
                wikiPageLink.href = `https://www.pediabible.com/index.php?title=${encodeURIComponent(title)}`;
                wikiPageLink.style.display = 'flex';
                  
                  
                 // لینک صفحه کامل برای باز کردن در تب جدید
                 if (!pageTitle) {
                wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                    updateNavigationButtons();
                wikiPageLink.style.display = 'flex';
                }
                updateNavigationButtons();
             }
             }


             // پردازش محتوای ویکی و حذف المان‌های اضافی
             // پردازش محتوا و حذف المان‌های اضافی
             function processWikiContent(html) {
             function processContent(html) {
                 const tempDiv = document.createElement('div');
                 const tempDiv = document.createElement('div');
                 tempDiv.innerHTML = html;
                 tempDiv.innerHTML = html;
               
 
                 // حذف هدرها و منوها
                 // حذف تمام المان‌های اضافی
                 const elementsToRemove = tempDiv.querySelectorAll(
                 const elementsToRemove = tempDiv.querySelectorAll(
                     'header, nav, .mw-header, .wiki-header, .header, #header, .navigation, .nav, .mw-nav, #mw-navigation'
                     'header, nav, .mw-header, .wiki-header, .header, #header, .navigation, .nav, .mw-nav, #mw-navigation, script, style, link, meta, .mw-editsection, .reference, .references, .mw-cite-backlink'
                 );
                 );
                 elementsToRemove.forEach(el => el.remove());
                 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"]');
                 const links = tempDiv.querySelectorAll('a[href*="pediabible.com"]');
                 links.forEach(link => {
                 links.forEach(link => {
خط ۸۳۱: خط ۷۹۵:
                     const titleParam = url.searchParams.get('title');
                     const titleParam = url.searchParams.get('title');
                     if (titleParam) {
                     if (titleParam) {
                        link.href = 'javascript:void(0)';
                         link.setAttribute('data-wiki-title', titleParam);
                         link.setAttribute('data-wiki-title', titleParam);
                         link.classList.add('wiki-internal-link');
                         link.classList.add('internal-link');
                     }
                     }
                 });
                 });
               
 
                 return tempDiv.innerHTML;
                 return tempDiv.innerHTML;
             }
             }


             // تنظیم event handler برای لینک‌ها
             // تنظیم event listener برای لینک‌های داخلی
             function setupLinkHandlers() {
             function setupInternalLinks() {
                 const links = versesContainer.querySelectorAll('.wiki-internal-link');
                 const links = versesContainer.querySelectorAll('.internal-link');
                  
                  
                 links.forEach(link => {
                 links.forEach(link => {
خط ۸۴۹: خط ۸۱۴:
                          
                          
                         if (title) {
                         if (title) {
                             // بارگذاری صفحه جدید
                             // بارگذاری صفحه جدید با همان روش
                             loadWikiPage(title);
                             loadContent(title);
                         }
                         }
                     });
                     });
                 });
                 });
            }
            // بارگذاری صفحه ویکی
            async function loadWikiPage(title) {
                chapterTitle.textContent = `صفحه: ${decodeURIComponent(title)}`;
               
                // نمایش loading
                versesContainer.innerHTML = `
                    <div class="loading">
                        <i class="fas fa-spinner fa-spin"></i>
                        <p>در حال بارگذاری محتوا...</p>
                    </div>
                `;
               
                const contentUrl = `${translations[currentTranslation].baseUrl}${title}&action=render`;
               
                try {
                    const response = await fetch(contentUrl);
                    const html = await response.text();
                   
                    // پردازش HTML و استخراج محتوای اصلی
                    const processedContent = processWikiContent(html);
                   
                    // نمایش محتوا
                    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>
                        </div>
                    `;
                }
               
                // به‌روزرسانی لینک صفحه کامل
                wikiPageLink.href = `${translations[currentTranslation].baseUrl}${title}`;
             }
             }


خط ۹۱۲: خط ۸۳۳:
                     currentChapter--;
                     currentChapter--;
                     chapterSelect.value = currentChapter;
                     chapterSelect.value = currentChapter;
                     displayChapterContent();
                     loadContent();
                 }
                 }
             });
             });
خط ۹۲۳: خط ۸۴۴:
                     currentChapter++;
                     currentChapter++;
                     chapterSelect.value = currentChapter;
                     chapterSelect.value = currentChapter;
                     displayChapterContent();
                     loadContent();
                 }
                 }
             });
             });

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

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

کتاب مقدس

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