پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۱۷۱: خط ۱۷۱:
         .content-display {
         .content-display {
             width: 100%;
             width: 100%;
            height: 650px;
             border: 1px solid var(--border-color);
             border: 1px solid var(--border-color);
             border-radius: 8px;
             border-radius: 8px;
             background: white;
             background: white;
            padding: 20px;
            max-height: 650px;
            overflow-y: auto;
        }
       
        .wiki-content {
            line-height: 1.8;
            font-size: 1.1rem;
        }
       
        .wiki-content h1, .wiki-content h2, .wiki-content h3 {
            color: var(--primary-color);
            margin: 20px 0 15px;
        }
       
        .wiki-content p {
            margin-bottom: 15px;
        }
       
        .wiki-content table {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
        }
       
        .wiki-content table, .wiki-content th, .wiki-content td {
            border: 1px solid var(--border-color);
        }
       
        .wiki-content th, .wiki-content td {
            padding: 8px 12px;
            text-align: right;
        }
       
        .wiki-content th {
            background-color: var(--light-color);
         }
         }
          
          
خط ۲۷۲: خط ۳۰۷:


         .loading i {
         .loading i {
            font-size: 2rem;
            margin-bottom: 10px;
        }
        .error {
            text-align: center;
            padding: 20px;
            color: #e74c3c;
        }
        .error i {
             font-size: 2rem;
             font-size: 2rem;
             margin-bottom: 10px;
             margin-bottom: 10px;
خط ۲۸۹: خط ۳۳۵:
              
              
             .content-display {
             .content-display {
                 height: 500px;
                 max-height: 500px;
             }
             }
              
              
خط ۳۸۶: خط ۴۳۲:
         ];
         ];


         // تابع JSONP برای دور زدن CORS
         // تابع برای دریافت صفحات از رده
         function jsonpRequest(url) {
         async function loadPagesFromCategory(categoryName) {
             return new Promise((resolve, reject) => {
             try {
                 const callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random());
                // استفاده از API مدیاویکی برای دریافت صفحات رده
                 const script = document.createElement('script');
                 const apiUrl = `https://www.pediabible.com/api.php?action=query&list=categorymembers&cmtitle=${encodeURIComponent(categoryName)}&cmlimit=500&format=json&origin=*`;
               
                 const response = await fetch(apiUrl);
               
                if (!response.ok) {
                    throw new Error(`خطای HTTP: ${response.status}`);
                }
                  
                  
                 window[callbackName] = function(data) {
                 const data = await response.json();
                    delete window[callbackName];
                    document.body.removeChild(script);
                   
                    if (data.error) {
                        reject(new Error(data.error.info));
                    } else {
                        resolve(data);
                    }
                };
 
                script.src = url + (url.includes('?') ? '&' : '?') + 'callback=' + callbackName;
                script.onerror = () => {
                    delete window[callbackName];
                    document.body.removeChild(script);
                    reject(new Error('JSONP request failed'));
                };
                  
                  
                 document.body.appendChild(script);
                 if (data.error) {
            });
                    throw new Error(data.error.info);
        }
                 }
 
        // تابع برای دریافت صفحات از رده با JSONP
        async function loadPagesFromCategory(categoryName) {
            try {
                const apiUrl = `https://www.pediabible.com/api.php?action=query&list=categorymembers&cmtitle=${encodeURIComponent(categoryName)}&cmlimit=500&format=json`;
                 const data = await jsonpRequest(apiUrl);
                  
                  
                 if (data.query && data.query.categorymembers) {
                 if (data.query && data.query.categorymembers) {
                     return data.query.categorymembers
                     return data.query.categorymembers
                         .filter(member => member.ns === 0)
                         .filter(member => member.ns === 0) // فقط صفحات اصلی
                         .map(member => ({
                         .map(member => ({
                             title: member.title,
                             title: member.title,
خط ۴۳۳: خط ۴۶۳:
             } catch (error) {
             } catch (error) {
                 throw new Error('خطا در بارگذاری صفحات: ' + error.message);
                 throw new Error('خطا در بارگذاری صفحات: ' + error.message);
            }
        }
        // تابع برای دریافت محتوای صفحه
        async function loadPageContent(pageTitle) {
            try {
                // دریافت محتوای صفحه به صورت HTML
                const apiUrl = `https://www.pediabible.com/api.php?action=parse&page=${encodeURIComponent(pageTitle)}&format=json&prop=text&origin=*`;
               
                const response = await fetch(apiUrl);
               
                if (!response.ok) {
                    throw new Error(`خطای HTTP: ${response.status}`);
                }
               
                const data = await response.json();
               
                if (data.error) {
                    throw new Error(data.error.info);
                }
               
                if (data.parse && data.parse.text && data.parse.text['*']) {
                    return data.parse.text['*'];
                } else {
                    throw new Error('محتوای صفحه یافت نشد');
                }
            } catch (error) {
                throw new Error('خطا در بارگذاری محتوا: ' + error.message);
             }
             }
         }
         }
خط ۴۸۲: خط ۵۴۰:
                          
                          
                         versesContainer.innerHTML = `
                         versesContainer.innerHTML = `
                             <div class="loading">
                             <div class="error">
                                 <i class="fas fa-exclamation-triangle"></i>
                                 <i class="fas fa-exclamation-triangle"></i>
                                 <p>${error.message}</p>
                                 <p>${error.message}</p>
خط ۴۹۸: خط ۵۵۶:


             // رویداد تغییر صفحه
             // رویداد تغییر صفحه
             pageSelect.addEventListener('change', function() {
             pageSelect.addEventListener('change', async function() {
                 currentPageIndex = parseInt(this.value);
                 currentPageIndex = parseInt(this.value);
                  
                  
                 if (!isNaN(currentPageIndex)) {
                 if (!isNaN(currentPageIndex)) {
                     displayPageContent();
                     await displayPageContent();
                 } else {
                 } else {
                     resetContent();
                     resetContent();
خط ۵۰۹: خط ۵۶۷:


             // نمایش محتوای صفحه
             // نمایش محتوای صفحه
             function displayPageContent() {
             async function displayPageContent() {
                 const page = currentPages[currentPageIndex];
                 const page = currentPages[currentPageIndex];
                 const category = categories.find(cat => cat.id === currentCategory);
                 const category = categories.find(cat => cat.id === currentCategory);
                  
                  
                 chapterTitle.textContent = `${category.name} - ${page.displayName}`;
                 chapterTitle.textContent = `${category.name} - ${page.displayName}`;
               
                const contentUrl = `https://www.pediabible.com/index.php?title=${encodeURIComponent(page.title)}&action=render`;
                  
                  
                 versesContainer.innerHTML = `
                 versesContainer.innerHTML = `
خط ۵۲۴: خط ۵۸۰:
                 `;
                 `;
                  
                  
                 setTimeout(() => {
                 try {
                    const content = await loadPageContent(page.title);
                   
                     versesContainer.innerHTML = `
                     versesContainer.innerHTML = `
                         <iframe
                         <div class="content-display">
                            src="${contentUrl}"
                             <div class="wiki-content">${content}</div>
                            class="content-display"
                         </div>
                             frameborder="0"
                            loading="lazy"
                            sandbox="allow-scripts allow-same-origin allow-popups"
                            allowfullscreen>
                         </iframe>
                     `;
                     `;
                 }, 500);
                   
                    // به روز رسانی لینک صفحه کامل
                    wikiPageLink.href = `https://www.pediabible.com/index.php?title=${encodeURIComponent(page.title)}`;
                    wikiPageLink.style.display = 'flex';
                   
                 } catch (error) {
                    console.error('خطا در بارگذاری محتوا:', error);
                    versesContainer.innerHTML = `
                        <div class="error">
                            <i class="fas fa-exclamation-triangle"></i>
                            <p>${error.message}</p>
                        </div>
                    `;
                }
                  
                  
                wikiPageLink.href = `https://www.pediabible.com/index.php?title=${encodeURIComponent(page.title)}`;
                wikiPageLink.style.display = 'flex';
                 updateNavigationButtons();
                 updateNavigationButtons();
             }
             }
خط ۵۴۷: خط ۶۱۱:
             }
             }


             prevPageBtn.addEventListener('click', function() {
             prevPageBtn.addEventListener('click', async function() {
                 if (currentPageIndex > 0) {
                 if (currentPageIndex > 0) {
                     currentPageIndex--;
                     currentPageIndex--;
                     pageSelect.value = currentPageIndex;
                     pageSelect.value = currentPageIndex;
                     displayPageContent();
                     await displayPageContent();
                 }
                 }
             });
             });


             nextPageBtn.addEventListener('click', function() {
             nextPageBtn.addEventListener('click', async function() {
                 if (currentPageIndex < currentPages.length - 1) {
                 if (currentPageIndex < currentPages.length - 1) {
                     currentPageIndex++;
                     currentPageIndex++;
                     pageSelect.value = currentPageIndex;
                     pageSelect.value = currentPageIndex;
                     displayPageContent();
                     await displayPageContent();
                 }
                 }
             });
             });
خط ۵۸۱: خط ۶۴۵:
         }
         }


         // شروع برنامه - روش سازگار با مدیاویکی
         // شروع برنامه
         if (typeof mw !== 'undefined' && mw.loader) {
         document.addEventListener('DOMContentLoaded', function() {
            // استفاده از mw.loader اگر در مدیاویکی هستیم
            console.log('🚀 شروع بارگذاری کتابخانه دانشنامه...');
            mw.loader.using('mediawiki.api').then(function() {
            initializeEncyclopediaApp();
                initializeEncyclopediaApp();
        });
            });
        } else {
            // استفاده از DOMContentLoaded برای محیط عادی
            document.addEventListener('DOMContentLoaded', function() {
                console.log('🚀 شروع بارگذاری کتابخانه دانشنامه...');
                initializeEncyclopediaApp();
            });
        }
     </script>
     </script>
</body>
</body>
</html>
</html>

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

<!DOCTYPE html> کتابخانه دانشنامه تخصصی

کتابخانه دانشنامه تخصصی

دسترسی به مجموعه کامل کتاب‌ها، مقالات و ترجمه‌های تخصصی

دسته‌بندی

صفحه

لطفاً دسته‌بندی و صفحه مورد نظر را انتخاب کنید

برای مطالعه محتوا، لطفاً ابتدا دسته‌بندی و سپس صفحه مورد نظر خود را انتخاب کنید.