پرش به محتوا

تست: تفاوت میان نسخه‌ها

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۲: خط ۲:
<html lang="fa" dir="rtl">
<html lang="fa" dir="rtl">
<head>
<head>
     <meta charset="UTF-8">
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
     <title>کتابخانه پدیا بایبل - مطالعه کتاب‌ها و مقالات</title>
     <title>کتابخانه پدیا بایبل</title>
     <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.5.0/css/all.min.css" />
     <style>
     <style>
         * {
         * {
خط ۱۱: خط ۱۱:
             padding: 0;
             padding: 0;
             box-sizing: border-box;
             box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
         }
         }
       
         :root {
         :root {
             --primary-color: #2c5530;
             --primary: #2c5530;
             --secondary-color: #4a7c59;
             --secondary: #4a7c59;
            --accent-color: #8fb996;
             --light: #f8f9fa;
             --light-color: #f8f9fa;
             --border: #dee2e6;
             --dark-color: #343a40;
             --text: #333;
             --text-color: #333;
            --border-color: #dee2e6;
            --shadow: 0 4px 12px rgba(0,0,0,0.1);
            --transition: all 0.3s ease;
         }
         }
       
         body {
         body {
            font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
             background: #f0f2f5;
             background: #f0f2f5;
             color: var(--text-color);
             color: var(--text);
            padding: 15px;
             line-height: 1.6;
             line-height: 1.6;
            padding: 10px;
            min-height: 100vh;
         }
         }
       
         .container {
         .container {
             max-width: 1200px;
             max-width: 1000px;
             margin: 0 auto;
             margin: 0 auto;
             background: white;
             background: white;
            padding: 15px;
             border-radius: 10px;
             border-radius: 8px;
             box-shadow: 0 2px 12px rgba(0,0,0,0.08);
             box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            overflow: hidden;
         }
         }
       
         .header {
         .header {
             background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
             background: linear-gradient(135deg, var(--primary), var(--secondary));
             color: white;
             color: white;
             padding: 20px;
             padding: 24px 20px;
            border-radius: 8px;
            margin-bottom: 20px;
             text-align: center;
             text-align: center;
         }
         }
          
         .header h1 {
        h1 {
             font-size: 26px;
            margin: 0;
             margin-bottom: 8px;
             font-size: 24px;
             font-weight: 700;
         }
         }
       
         .header p {
         .description {
             opacity: 0.95;
             color: rgba(255,255,255,0.9);
             font-size: 14px;
             font-size: 14px;
            margin-top: 8px;
         }
         }
       
         .section {
         .stats-bar {
             padding: 20px;
            display: flex;
            justify-content: space-between;
            background: var(--light-color);
             padding: 10px 15px;
            border-radius: 6px;
            margin-bottom: 15px;
            border: 1px solid var(--border-color);
            font-size: 13px;
         }
         }
       
         .form-group {
         .stat-item {
            display: flex;
            align-items: center;
            gap: 6px;
        }
       
        .stat-value {
            font-weight: bold;
            color: var(--primary-color);
        }
       
        .filter-section {
             margin-bottom: 20px;
             margin-bottom: 20px;
            background: var(--light-color);
            padding: 15px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
        }
       
        .filter-row {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
        }
       
        .form-group {
            flex: 1;
         }
         }
       
         label {
         label {
             display: block;
             display: block;
             margin-bottom: 6px;
             margin-bottom: 8px;
             font-weight: 600;
             font-weight: 600;
             color: var(--dark-color);
             color: #444;
            font-size: 14px;
        }
       
        .custom-select-container {
            position: relative;
         }
         }
          
         select {
        .custom-select {
             width: 100%;
             width: 100%;
             padding: 10px 12px;
             padding: 12px;
             border: 1px solid var(--border-color);
             border: 1px solid var(--border);
             border-radius: 6px;
             border-radius: 8px;
             font-size: 14px;
             font-size: 15px;
             background: white;
             background: white;
             cursor: pointer;
             direction: rtl;
            text-align: right;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
       
        .custom-select:hover {
            border-color: var(--accent-color);
         }
         }
          
         select:disabled {
        .custom-select.active {
             background-color: #f5f5f5;
             border-color: var(--primary-color);
            color: #999;
         }
         }
       
         .btn {
         .custom-select i {
            color: var(--primary-color);
            transition: var(--transition);
            font-size: 12px;
        }
       
        .custom-select.active i {
            transform: rotate(180deg);
        }
       
        .custom-select-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            margin-top: 5px;
            box-shadow: var(--shadow);
            z-index: 1000;
            display: none;
            max-height: 250px;
            overflow: hidden;
        }
       
        .custom-select-dropdown.show {
             display: block;
             display: block;
        }
       
        .search-box {
            padding: 10px;
            border-bottom: 1px solid var(--border-color);
            background: var(--light-color);
        }
       
        .search-box input {
             width: 100%;
             width: 100%;
             padding: 8px 10px;
             padding: 14px;
            border: 1px solid var(--border-color);
             background: var(--primary);
            border-radius: 4px;
            font-size: 13px;
            transition: var(--transition);
        }
       
        .search-box input:focus {
            outline: none;
            border-color: var(--accent-color);
        }
       
        .options-container {
            max-height: 200px;
            overflow-y: auto;
        }
       
        .option-item {
            padding: 10px 12px;
            cursor: pointer;
            border-bottom: 1px solid #f0f0f0;
            font-size: 13px;
            transition: var(--transition);
        }
       
        .option-item:last-child {
            border-bottom: none;
        }
       
        .option-item:hover {
            background-color: #e9ecef;
        }
       
        .option-item.selected {
             background-color: var(--primary-color);
             color: white;
             color: white;
        }
             border: none;
       
        .content-section {
            margin-top: 15px;
             border: 1px solid var(--border-color);
             border-radius: 8px;
             border-radius: 8px;
             overflow: hidden;
             font-size: 16px;
            background: white;
            height: 500px;
            display: flex;
            flex-direction: column;
        }
       
        .content-header {
            padding: 12px 15px;
            background: var(--light-color);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
       
        .content-title {
             font-weight: 600;
             font-weight: 600;
            color: var(--primary-color);
            font-size: 16px;
        }
       
        .content-controls {
            display: flex;
            gap: 8px;
        }
       
        .control-btn {
            background: white;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 5px 10px;
             cursor: pointer;
             cursor: pointer;
             font-size: 12px;
             transition: all 0.2s;
            transition: var(--transition);
             margin-top: 10px;
            display: flex;
             align-items: center;
            gap: 4px;
         }
         }
       
         .btn:hover:not(:disabled) {
         .control-btn:hover {
             background: #254528;
            background: var(--light-color);
             transform: translateY(-2px);
        }
       
        .iframe-container {
             width: 100%;
             flex: 1;
            position: relative;
        }
       
        .clean-frame {
            width: 100%;
            height: 100%;
            border: none;
            background: white;
         }
         }
       
         .btn:disabled {
         .iframe-placeholder {
             background: #ccc;
             display: flex;
             cursor: not-allowed;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #6c757d;
            font-size: 15px;
            text-align: center;
            padding: 15px;
             background: white;
            flex-direction: column;
         }
         }
       
         .stats {
         .action-buttons {
             display: flex;
             display: flex;
             justify-content: space-between;
             justify-content: space-around;
             align-items: center;
             background: var(--light);
             padding: 12px 15px;
             padding: 14px;
             background-color: var(--light-color);
             border-radius: 8px;
             border-top: 1px solid var(--border-color);
            margin: 20px 0;
             gap: 10px;
             font-size: 14px;
             color: #555;
         }
         }
       
         .stat {
         .wiki-link, .site-link, .view-link {
            background: var(--primary-color);
            color: white;
            text-decoration: none;
            font-weight: 600;
            padding: 8px 15px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 13px;
             text-align: center;
             text-align: center;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
         }
         }
       
         .stat strong {
         .site-link {
             color: var(--primary);
             background: #6c757d;
            font-size: 18px;
        }
             display: block;
       
        .view-link {
             background: var(--secondary-color);
         }
         }
       
         .recent {
        .site-link:hover, .wiki-link:hover, .view-link:hover {
             margin-top: 25px;
            opacity: 0.9;
            transform: translateY(-1px);
        }
       
         .recent-section {
             margin-top: 20px;
            background: var(--light-color);
            padding: 15px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
         }
         }
       
         .recent h3 {
         .section-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--primary-color);
             margin-bottom: 12px;
             margin-bottom: 12px;
            color: var(--primary);
             display: flex;
             display: flex;
             align-items: center;
             align-items: center;
             gap: 8px;
             gap: 8px;
         }
         }
       
         .recent-list {
         .recent-items {
             display: flex;
             display: flex;
            flex-wrap: wrap;
             gap: 10px;
             gap: 10px;
            overflow-x: auto;
            padding: 5px;
         }
         }
       
         .recent-item {
         .recent-item {
             background: white;
             background: #eef5ee;
            padding: 10px 14px;
             border-radius: 6px;
             border-radius: 6px;
            padding: 12px;
            min-width: 150px;
            border: 1px solid var(--border-color);
             cursor: pointer;
             cursor: pointer;
             transition: var(--transition);
             font-size: 14px;
             text-align: center;
             transition: all 0.2s;
         }
         }
       
         .recent-item:hover {
         .recent-item:hover {
             transform: translateY(-2px);
             background: var(--primary);
             box-shadow: 0 2px 5px rgba(0,0,0,0.1);
             color: white;
         }
         }
       
         .empty {
         .recent-title {
             color: #888;
            font-weight: 600;
             font-style: italic;
            font-size: 13px;
             color: var(--dark-color);
        }
       
        .recent-category {
             font-size: 11px;
            color: #6c757d;
            margin-top: 4px;
        }
       
        .empty-recent {
             text-align: center;
             text-align: center;
            color: #6c757d;
             padding: 15px;
             padding: 15px;
            font-style: italic;
            width: 100%;
         }
         }
       
         @media (max-width: 600px) {
        .loading-bar {
             .stats {
            height: 3px;
            background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
            width: 0%;
            transition: width 0.4s ease;
            position: absolute;
            top: 0;
            right: 0;
        }
       
         @media (max-width: 768px) {
            body {
                padding: 5px;
            }
            .container {
                padding: 10px;
            }
            .filter-row {
                flex-direction: column;
            }
            .content-section {
                height: 400px;
            }
            .action-buttons {
                flex-direction: column;
            }
            .wiki-link, .site-link, .view-link {
                width: 100%;
            }
             .stats-bar {
                flex-direction: column;
                gap: 8px;
            }
            .content-header {
                flex-direction: column;
                gap: 8px;
                align-items: flex-start;
            }
            .content-controls {
                width: 100%;
                justify-content: space-between;
            }
            .recent-items {
                 flex-direction: column;
                 flex-direction: column;
                gap: 12px;
             }
             }
             .recent-item {
             .header h1 {
                 min-width: auto;
                 font-size: 22px;
             }
             }
         }
         }
خط ۴۴۶: خط ۱۶۱:
         <div class="header">
         <div class="header">
             <h1>کتابخانه پدیا بایبل</h1>
             <h1>کتابخانه پدیا بایبل</h1>
             <div class="description">
             <p>مرجع تخصصی پژوهش و تحلیل کتاب مقدس — انتخاب کتاب یا مقاله و مشاهده در سایت اصلی</p>
                در این بخش می‌توانید کتاب‌ها و مقالات مختلف را مطالعه کنید.
                برای شروع، دسته‌بندی و سپس مورد مورد نظر خود را انتخاب نمایید.
            </div>
         </div>
         </div>
       
 
         <div class="stats-bar">
         <div class="section">
             <div class="stat-item">
             <div class="stats">
                <i class="fas fa-book"></i>
                 <div class="stat">
                 <span>تعداد کتاب‌ها: <span class="stat-value" id="booksCount">4</span></span>
                    <i class="fas fa-book"></i> کتاب‌ها
            </div>
                    <strong id="bookCount">4</strong>
            <div class="stat-item">
                <i class="fas fa-file-alt"></i>
                <span>تعداد مقالات: <span class="stat-value" id="articlesCount">4</span></span>
            </div>
            <div class="stat-item">
                <i class="fas fa-history"></i>
                <span>مطالب مطالعه شده: <span class="stat-value" id="readCount">0</span></span>
            </div>
        </div>
       
        <div class="filter-section">
            <div class="filter-row">
                <div class="form-group">
                    <label for="categorySelect">دسته‌بندی:</label>
                    <select id="categorySelect">
                        <option value="">لطفاً دسته‌بندی انتخاب کنید</option>
                        <option value="کتاب">کتاب</option>
                        <option value="مقاله">مقاله</option>
                    </select>
                 </div>
                 </div>
               
                 <div class="stat">
                 <div class="form-group">
                     <i class="fas fa-file-alt"></i> مقالات
                     <label for="bookSelect">انتخاب محتوا:</label>
                    <strong id="articleCount">4</strong>
                    <div class="custom-select-container">
                        <div class="custom-select" id="customSelectDisplay">
                            <span>ابتدا دسته‌بندی را انتخاب کنید</span>
                            <i class="fas fa-chevron-down"></i>
                        </div>
                       
                        <div class="custom-select-dropdown" id="customDropdown">
                            <div class="search-box">
                                <input type="text" id="dropdownSearch" placeholder="جستجو در محتواها...">
                            </div>
                            <div class="options-container" id="optionsContainer">
                                <!-- محتواها اینجا نمایش داده خواهند شد -->
                            </div>
                        </div>
                    </div>
                 </div>
                 </div>
            </div>
                 <div class="stat">
        </div>
                     <i class="fas fa-history"></i> مطالعه شده
       
                     <strong id="readCount">0</strong>
        <div class="content-section">
            <div class="content-header">
                 <div class="content-title" id="contentTitle">هیچ محتوایی انتخاب نشده است</div>
                <div class="content-controls">
                     <button class="control-btn" id="zoomOut"><i class="fas fa-search-minus"></i> کوچک‌نمایی</button>
                    <button class="control-btn" id="zoomIn"><i class="fas fa-search-plus"></i> بزرگ‌نمایی</button>
                     <button class="control-btn" id="refreshBtn"><i class="fas fa-redo"></i> بارگذاری مجدد</button>
                 </div>
                 </div>
             </div>
             </div>
             <div class="loading-bar" id="loadingBar"></div>
 
            <div class="iframe-container">
             <div class="form-group">
                 <div class="iframe-placeholder" id="iframePlaceholder">
                <label for="category"><i class="fas fa-folder"></i> دسته‌بندی</label>
                     <div>
                 <select id="category">
                        <i class="fas fa-book-open" style="font-size: 2.5rem; color: #6c757d; margin-bottom: 10px;"></i>
                     <option value="">— انتخاب کنید —</option>
                        <p>لطفاً یک کتاب یا مقاله از لیست انتخاب کنید</p>
                    <option value="کتاب">کتاب</option>
                     </div>
                     <option value="مقاله">مقاله</option>
                </div>
                 </select>
                 <iframe id="contentFrame" class="clean-frame" src="about:blank" style="display: none;"></iframe>
             </div>
             </div>
             <div class="action-buttons">
 
                 <a id="siteLink" href="#" class="site-link" target="_blank" style="display: none;">
             <div class="form-group">
                    <i class="fas fa-external-link-alt"></i>
                 <label for="content"><i class="fas fa-book-open"></i> انتخاب محتوا</label>
                    مشاهده صفحه در سایت اصلی
                 <select id="content" disabled>
                </a>
                     <option>— ابتدا دسته‌بندی را انتخاب کنید —</option>
                 <a id="wikiLink" href="#" class="wiki-link" target="_blank" style="display: none;">
                 </select>
                     <i class="fab fa-wikipedia-w"></i>
                    مشاهده صفحه کامل در ویکی
                </a>
                <a id="viewLink" href="#" class="view-link" target="_blank" style="display: none;">
                    <i class="fas fa-eye"></i>
                    مشاهده صفحه
                 </a>
             </div>
             </div>
            <button id="goBtn" class="btn" disabled>
                <i class="fas fa-external-link-alt"></i> مشاهده در سایت پدیا بایبل
            </button>
         </div>
         </div>
       
 
         <div class="recent-section">
         <div class="section recent">
             <div class="section-title">
             <h3><i class="fas fa-history"></i> مطالب مطالعه‌شده اخیر</h3>
                <i class="fas fa-history"></i>
             <div class="recent-list" id="recentList">
                مطالب مطالعه شده اخیر
                 <div class="empty">هیچ مطلبی اخیراً باز نشده است.</div>
            </div>
             <div class="recent-items" id="recentItems">
                 <div class="empty-recent">هیچ مطلبی اخیراً مطالعه نشده است</div>
             </div>
             </div>
         </div>
         </div>
خط ۵۴۶: خط ۲۱۰:


     <script>
     <script>
         const booksData = {
         const data = {
             'کتاب': [
             کتاب: [
                 { value: 'عیسی', text: 'عیسی' },
                 { value: 'عیسی', text: 'عیسی' },
                 { value: 'انجیل_متی', text: 'انجیل متی' },
                 { value: 'انجیل_متی', text: 'انجیل متی' },
خط ۵۵۳: خط ۲۱۷:
                 { value: 'پیدایش', text: 'پیدایش' }
                 { value: 'پیدایش', text: 'پیدایش' }
             ],
             ],
             'مقاله': [
             مقاله: [
                 { value: 'مسیح', text: 'مسیح' },
                 { value: 'مسیح', text: 'مسیح' },
                 { value: 'تثلیث', text: 'تثلیث' },
                 { value: 'تثلیث', text: 'تثلیث' },
خط ۵۶۱: خط ۲۲۵:
         };
         };


         const elements = {
         const categorySelect = document.getElementById('category');
            categorySelect: document.getElementById('categorySelect'),
        const contentSelect = document.getElementById('content');
            customSelectDisplay: document.getElementById('customSelectDisplay'),
        const goBtn = document.getElementById('goBtn');
            customDropdown: document.getElementById('customDropdown'),
        const recentList = document.getElementById('recentList');
            dropdownSearch: document.getElementById('dropdownSearch'),
        const bookCountEl = document.getElementById('bookCount');
            optionsContainer: document.getElementById('optionsContainer'),
         const articleCountEl = document.getElementById('articleCount');
            contentFrame: document.getElementById('contentFrame'),
         const readCountEl = document.getElementById('readCount');
            iframePlaceholder: document.getElementById('iframePlaceholder'),
            wikiLink: document.getElementById('wikiLink'),
            siteLink: document.getElementById('siteLink'),
            viewLink: document.getElementById('viewLink'),
            contentTitle: document.getElementById('contentTitle'),
            booksCount: document.getElementById('booksCount'),
            articlesCount: document.getElementById('articlesCount'),
            readCount: document.getElementById('readCount'),
            zoomIn: document.getElementById('zoomIn'),
            zoomOut: document.getElementById('zoomOut'),
            refreshBtn: document.getElementById('refreshBtn'),
            loadingBar: document.getElementById('loadingBar'),
            recentItems: document.getElementById('recentItems')
        };
 
         let currentCategory = '';
        let currentSelection = { value: '', text: '' };
        let currentZoom = 100;
        let readItems = JSON.parse(localStorage.getItem('readItems')) || [];
 
         function init() {
            updateStats();
            updateRecentItems();
            setupEventListeners();
        }
 
        function setupEventListeners() {
            elements.categorySelect.addEventListener('change', function() {
                currentCategory = this.value;
                updateBookList();
            });
 
            elements.customSelectDisplay.addEventListener('click', function(e) {
                e.stopPropagation();
                if (!currentCategory) {
                    alert('لطفاً ابتدا یک دسته‌بندی انتخاب کنید');
                    return;
                }
                toggleDropdown();
            });


            document.addEventListener('click', function() {
        let selectedCategory = '';
                elements.customDropdown.classList.remove('show');
        let selectedContent = '';
                elements.customSelectDisplay.classList.remove('active');
            });


            elements.customDropdown.addEventListener('click', function(e) {
        // بارگذاری تاریخچه از localStorage
                e.stopPropagation();
        let readHistory = JSON.parse(localStorage.getItem('pediabible_history')) || [];
            });
 
            elements.dropdownSearch.addEventListener('input', function() {
                populateDropdownOptions(this.value);
            });
 
            elements.zoomIn.addEventListener('click', () => {
                if (currentZoom < 150) {
                    currentZoom += 10;
                    applyZoom();
                }
            });
 
            elements.zoomOut.addEventListener('click', () => {
                if (currentZoom > 50) {
                    currentZoom -= 10;
                    applyZoom();
                }
            });
 
            elements.refreshBtn.addEventListener('click', () => {
                if (currentSelection.value) {
                    showContent(currentSelection.value, currentSelection.text);
                }
            });
        }


        // به‌روزرسانی آمار
         function updateStats() {
         function updateStats() {
             elements.booksCount.textContent = booksData['کتاب'].length;
             bookCountEl.textContent = data.کتاب.length;
             elements.articlesCount.textContent = booksData['مقاله'].length;
             articleCountEl.textContent = data.مقاله.length;
             elements.readCount.textContent = readItems.length;
             readCountEl.textContent = readHistory.length;
         }
         }


         function updateRecentItems() {
        // پر کردن لیست محتوا
             if (readItems.length === 0) {
         function populateContent() {
                 elements.recentItems.innerHTML = '<div class="empty-recent">هیچ مطلبی اخیراً مطالعه نشده است</div>';
            contentSelect.innerHTML = '';
            const items = data[selectedCategory] || [];
             if (items.length === 0) {
                 const opt = document.createElement('option');
                opt.text = 'محتوایی یافت نشد';
                contentSelect.appendChild(opt);
                contentSelect.disabled = true;
                goBtn.disabled = true;
                 return;
                 return;
             }
             }
           
 
            elements.recentItems.innerHTML = '';
             items.forEach(item => {
            const recentToShow = readItems.slice(-5).reverse();
                 const opt = document.createElement('option');
              
                 opt.value = item.value;
            recentToShow.forEach(item => {
                opt.text = item.text;
                 const recentItem = document.createElement('div');
                 contentSelect.appendChild(opt);
                 recentItem.className = 'recent-item';
                recentItem.innerHTML = `
                    <div class="recent-title">${item.text}</div>
                    <div class="recent-category">${item.category}</div>
                `;
               
                recentItem.addEventListener('click', () => {
                    currentCategory = item.category;
                    elements.categorySelect.value = currentCategory;
                    currentSelection = { value: item.value, text: item.text };
                    elements.customSelectDisplay.innerHTML = `<span>${item.text}</span><i class="fas fa-chevron-down"></i>`;
                    showContent(item.value, item.text);
                });
                  
                elements.recentItems.appendChild(recentItem);
             });
             });
        }


        function toggleDropdown() {
             contentSelect.disabled = false;
             const isOpen = elements.customDropdown.classList.contains('show');
            if (!isOpen) {
                elements.customDropdown.classList.add('show');
                elements.customSelectDisplay.classList.add('active');
                populateDropdownOptions();
                elements.dropdownSearch.value = '';
                setTimeout(() => elements.dropdownSearch.focus(), 100);
            } else {
                elements.customDropdown.classList.remove('show');
                elements.customSelectDisplay.classList.remove('active');
            }
         }
         }


         function populateDropdownOptions(searchTerm = '') {
        // نمایش تاریخچه
             if (!currentCategory || !booksData[currentCategory]) {
         function renderRecent() {
                 elements.optionsContainer.innerHTML = '<div class="option-item" style="color:#999;">دسته‌بندی نامعتبر است</div>';
             if (readHistory.length === 0) {
                 recentList.innerHTML = '<div class="empty">هیچ مطلبی اخیراً باز نشده است.</div>';
                 return;
                 return;
             }
             }


             const books = booksData[currentCategory];
             recentList.innerHTML = '';
             const searchLower = searchTerm.toLowerCase().trim();
             const last5 = readHistory.slice(-5).reverse();
             elements.optionsContainer.innerHTML = '';
             last5.forEach(item => {
                const div = document.createElement('div');
                div.className = 'recent-item';
                div.textContent = `${item.text} (${item.category})`;
                div.onclick = () => {
                    categorySelect.value = item.category;
                    selectedCategory = item.category;
                    populateContent();
                    contentSelect.value = item.value;
                    selectedContent = item.value;
                    goBtn.disabled = false;
                    openContent();
                };
                recentList.appendChild(div);
            });
        }


            const filteredBooks = books.filter(book =>
        // باز کردن صفحه
                book.text.toLowerCase().includes(searchLower)
        function openContent() {
             );
             if (!selectedCategory || !selectedContent) return;


             if (filteredBooks.length === 0) {
             const url = `https://www.pediabible.com/index.php/${selectedContent}`;
                const noResult = document.createElement('div');
            window.open(url, '_blank');
                noResult.className = 'option-item';
                noResult.textContent = 'نتیجه‌ای یافت نشد';
                noResult.style.color = '#999';
                elements.optionsContainer.appendChild(noResult);
                return;
            }


             filteredBooks.forEach(book => {
             // اضافه کردن به تاریخچه
                const optionItem = document.createElement('div');
            const newItem = {
                 optionItem.className = 'option-item';
                 category: selectedCategory,
                 optionItem.textContent = book.text;
                 value: selectedContent,
                optionItem.dataset.value = book.value;
                 text: contentSelect.options[contentSelect.selectedIndex]?.text || selectedContent
                 optionItem.dataset.text = book.text;
            };


                 if (book.value === currentSelection.value) {
            // جلوگیری از تکرار
                    optionItem.classList.add('selected');
            const exists = readHistory.some(
                }
                 item => item.category === newItem.category && item.value === newItem.value
            );


                optionItem.addEventListener('click', () => {
            if (!exists) {
                    const value = optionItem.dataset.value;
                readHistory.push(newItem);
                    const text = optionItem.dataset.text;
                localStorage.setItem('pediabible_history', JSON.stringify(readHistory));
 
                updateStats();
                    currentSelection = { value, text };
                 renderRecent();
                    elements.customSelectDisplay.innerHTML = `<span>${text}</span><i class="fas fa-chevron-down"></i>`;
                    elements.customSelectDisplay.style.color = '#333';
 
                    elements.customDropdown.classList.remove('show');
                    elements.customSelectDisplay.classList.remove('active');
 
                    showContent(value, text);
                });
 
                elements.optionsContainer.appendChild(optionItem);
            });
        }
 
        function updateBookList() {
            if (!currentCategory) {
                elements.customSelectDisplay.innerHTML = '<span>ابتدا دسته‌بندی را انتخاب کنید</span><i class="fas fa-chevron-down"></i>';
                elements.customSelectDisplay.style.color = '#6c757d';
                 resetContent();
                elements.optionsContainer.innerHTML = '';
                return;
             }
             }
            elements.customSelectDisplay.innerHTML = '<span>لطفاً محتوا انتخاب کنید</span><i class="fas fa-chevron-down"></i>';
            elements.customSelectDisplay.style.color = '#333';
            resetContent();
            // مهم: لیست را همین‌جا پر کن تا هنگام باز شدن آماده باشد
            populateDropdownOptions();
         }
         }


         function showContent(bookValue, bookText) {
         // event listeners
            if (!bookValue || !bookText) {
        categorySelect.addEventListener('change', () => {
                resetContent();
             selectedCategory = categorySelect.value;
                return;
             if (selectedCategory) {
            }
                 populateContent();
 
            } else {
             const newItem = { value: bookValue, text: bookText, category: currentCategory };
                 contentSelect.disabled = true;
             if (!readItems.some(item => item.value === bookValue && item.category === currentCategory)) {
                 goBtn.disabled = true;
                 readItems.push(newItem);
                 localStorage.setItem('readItems', JSON.stringify(readItems));
                 updateStats();
                updateRecentItems();
             }
             }
        });


            // ✅ URL بدون فاصله اضافه
        contentSelect.addEventListener('change', () => {
            const baseUrl = 'https://www.pediabible.com/index.php/';
             selectedContent = contentSelect.value;
            const contentUrl = `${baseUrl}${bookValue}?action=render`;
             goBtn.disabled = !selectedContent;
            const wikiUrl = `${baseUrl}${bookValue}`;
         });
            const siteUrl = `${baseUrl}${bookValue}`;
 
            elements.contentTitle.textContent = bookText;
            elements.contentFrame.style.display = 'none';
            elements.iframePlaceholder.style.display = 'flex';
            elements.iframePlaceholder.innerHTML = `
                <div>
                    <i class="fas fa-spinner fa-spin" style="font-size: 2.5rem; color: #2c5530; margin-bottom: 10px;"></i>
                    <p>در حال بارگذاری "${bookText}"...</p>
                </div>
            `;
 
            let progress = 0;
            const progressInterval = setInterval(() => {
                progress += Math.random() * 15;
                if (progress > 90) progress = 90;
                elements.loadingBar.style.width = `${progress}%`;
            }, 200);
 
            elements.contentFrame.src = contentUrl;
 
            elements.contentFrame.onload = function() {
                clearInterval(progressInterval);
                elements.loadingBar.style.width = '100%';
                setTimeout(() => elements.loadingBar.style.width = '0%', 500);
                elements.contentFrame.style.display = 'block';
                elements.iframePlaceholder.style.display = 'none';
                applyZoom();
            };
 
            elements.contentFrame.onerror = function() {
                clearInterval(progressInterval);
                elements.loadingBar.style.width = '0%';
                elements.iframePlaceholder.style.display = 'flex';
                elements.iframePlaceholder.innerHTML = `
                    <div>
                        <i class="fas fa-exclamation-triangle" style="font-size: 2.5rem; color: #dc3545; margin-bottom: 10px;"></i>
                        <p>خطا در بارگذاری "${bookText}". لطفاً دوباره تلاش کنید.</p>
                    </div>
                `;
                elements.contentFrame.style.display = 'none';
             };
 
            elements.wikiLink.href = wikiUrl;
            elements.wikiLink.style.display = 'flex';
             elements.siteLink.href = siteUrl;
            elements.siteLink.style.display = 'flex';
            elements.viewLink.href = contentUrl;
            elements.viewLink.style.display = 'flex';
         }
 
        function resetContent() {
            currentSelection = { value: '', text: '' };
            elements.contentTitle.textContent = 'هیچ محتوایی انتخاب نشده است';
            elements.contentFrame.style.display = 'none';
            elements.iframePlaceholder.style.display = 'flex';
            elements.iframePlaceholder.innerHTML = `
                <div>
                    <i class="fas fa-book-open" style="font-size: 2.5rem; color: #6c757d; margin-bottom: 10px;"></i>
                    <p>لطفاً یک کتاب یا مقاله از لیست انتخاب کنید</p>
                </div>
            `;
            elements.wikiLink.style.display = 'none';
            elements.siteLink.style.display = 'none';
            elements.viewLink.style.display = 'none';
            elements.contentFrame.src = 'about:blank';
        }


         function applyZoom() {
         goBtn.addEventListener('click', openContent);
            elements.contentFrame.style.zoom = `${currentZoom}%`;
        }


         init();
         // راه‌اندازی اولیه
        updateStats();
        renderRecent();
     </script>
     </script>
</body>
</body>
</html>
</html>

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

<!DOCTYPE html> کتابخانه پدیا بایبل

کتابخانه پدیا بایبل

مرجع تخصصی پژوهش و تحلیل کتاب مقدس — انتخاب کتاب یا مقاله و مشاهده در سایت اصلی

کتاب‌ها 4
مقالات 4
مطالعه شده 0

مطالب مطالعه‌شده اخیر

هیچ مطلبی اخیراً باز نشده است.