پرش به محتوا

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

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۹۷: خط ۹۷:
             background: white;
             background: white;
             cursor: pointer;
             cursor: pointer;
             appearance: none;
             text-align: right;
            -webkit-appearance: none;
            -moz-appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: left 10px center;
            background-size: 16px;
            padding-left: 35px;
         }
         }
          
          
خط ۱۸۳: خط ۱۷۶:
             width: 100%;
             width: 100%;
             height: 100%;
             height: 100%;
            position: relative;
         }
         }
          
          
خط ۲۶۴: خط ۲۵۶:
                     <label for="bookSelect">انتخاب محتوا:</label>
                     <label for="bookSelect">انتخاب محتوا:</label>
                     <div class="custom-select-container">
                     <div class="custom-select-container">
                         <select id="bookSelect" class="custom-select" disabled>
                        <div class="custom-select" id="customSelectDisplay">
                            ابتدا دسته‌بندی را انتخاب کنید
                        </div>
                         <select id="bookSelect" style="display: none;">
                             <option value="">ابتدا دسته‌بندی را انتخاب کنید</option>
                             <option value="">ابتدا دسته‌بندی را انتخاب کنید</option>
                         </select>
                         </select>
خط ۳۱۹: خط ۳۱۴:
         const categorySelect = document.getElementById('categorySelect');
         const categorySelect = document.getElementById('categorySelect');
         const bookSelect = document.getElementById('bookSelect');
         const bookSelect = document.getElementById('bookSelect');
         const customSelect = document.querySelector('.custom-select');
         const customSelectDisplay = document.getElementById('customSelectDisplay');
         const customDropdown = document.getElementById('customDropdown');
         const customDropdown = document.getElementById('customDropdown');
         const dropdownSearch = document.getElementById('dropdownSearch');
         const dropdownSearch = document.getElementById('dropdownSearch');
خط ۳۲۹: خط ۳۲۴:
         let isDropdownOpen = false;
         let isDropdownOpen = false;
         let currentCategory = '';
         let currentCategory = '';
        let currentSelection = { value: '', text: '' };


         // پر کردن لیست کتاب‌ها بر اساس دسته‌بندی
         // پر کردن لیست کتاب‌ها بر اساس دسته‌بندی
خط ۳۳۷: خط ۳۳۳:
             if (!selectedCategory) {
             if (!selectedCategory) {
                 // اگر دسته‌بندی انتخاب نشده
                 // اگر دسته‌بندی انتخاب نشده
                 bookSelect.disabled = true;
                 customSelectDisplay.textContent = 'ابتدا دسته‌بندی را انتخاب کنید';
                bookSelect.innerHTML = '<option value="">ابتدا دسته‌بندی را انتخاب کنید</option>';
                 customSelectDisplay.style.color = '#6c757d';
                 customSelect.textContent = 'ابتدا دسته‌بندی را انتخاب کنید';
                 resetContent();
                 resetContent();
                 return;
                 return;
خط ۳۴۵: خط ۳۴۰:
              
              
             const books = booksData[selectedCategory];
             const books = booksData[selectedCategory];
              
             customSelectDisplay.textContent = 'لطفاً محتوا انتخاب کنید';
            // فعال کردن select
             customSelectDisplay.style.color = '#333';
            bookSelect.disabled = false;
           
            // پاک کردن لیست فعلی
            bookSelect.innerHTML = '<option value="">لطفاً محتوا انتخاب کنید</option>';
              
            // پر کردن لیست جدید
            books.forEach(book => {
                const option = document.createElement('option');
                option.value = book.value;
                option.textContent = book.text;
                bookSelect.appendChild(option);
            });
           
            customSelect.textContent = 'لطفاً محتوا انتخاب کنید';
             resetContent();
             resetContent();
         }
         }


         // باز کردن/بستن dropdown
         // باز کردن/بستن dropdown
         customSelect.addEventListener('click', function(e) {
         customSelectDisplay.addEventListener('click', function(e) {
             if (bookSelect.disabled) return;
             if (!currentCategory) return;
              
              
             e.stopPropagation();
             e.stopPropagation();
خط ۴۰۸: خط ۳۸۹:
                 optionItem.textContent = book.text;
                 optionItem.textContent = book.text;
                 optionItem.setAttribute('data-value', book.value);
                 optionItem.setAttribute('data-value', book.value);
                optionItem.setAttribute('data-text', book.text);
                  
                  
                 if (book.value === bookSelect.value) {
                 if (book.value === currentSelection.value) {
                     optionItem.classList.add('selected');
                     optionItem.classList.add('selected');
                 }
                 }
                  
                  
                 optionItem.addEventListener('click', function() {
                 optionItem.addEventListener('click', function() {
                     bookSelect.value = this.getAttribute('data-value');
                     const value = this.getAttribute('data-value');
                     customSelect.textContent = this.textContent;
                    const text = this.getAttribute('data-text');
                      
                    currentSelection = { value, text };
                    customSelectDisplay.textContent = text;
                    customSelectDisplay.style.color = '#333';
                   
                     isDropdownOpen = false;
                     isDropdownOpen = false;
                     customDropdown.style.display = 'none';
                     customDropdown.style.display = 'none';
                      
                      
                     if (bookSelect.value) {
                     showContent(value, text);
                        showContent(bookSelect.value, this.textContent);
                    }
                 });
                 });
                  
                  
خط ۴۹۷: خط ۴۸۲:
         // بازنشانی محتوا
         // بازنشانی محتوا
         function resetContent() {
         function resetContent() {
            currentSelection = { value: '', text: '' };
             contentFrame.style.display = 'none';
             contentFrame.style.display = 'none';
             iframePlaceholder.style.display = 'flex';
             iframePlaceholder.style.display = 'flex';
خط ۵۱۱: خط ۴۹۷:
         // رویداد تغییر دسته‌بندی
         // رویداد تغییر دسته‌بندی
         categorySelect.addEventListener('change', updateBookList);
         categorySelect.addEventListener('change', updateBookList);
        // رویداد تغییر کتاب
        bookSelect.addEventListener('change', function() {
            console.log('تغییر کتاب:', this.value);
            if (this.value) {
                const selectedOption = this.options[this.selectedIndex];
                customSelect.textContent = selectedOption.text;
                showContent(selectedOption.value, selectedOption.text);
            } else {
                customSelect.textContent = 'لطفاً محتوا انتخاب کنید';
                resetContent();
            }
        });


         // بارگذاری اولیه - هیچ چیزی انتخاب نشده
         // بارگذاری اولیه - هیچ چیزی انتخاب نشده

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

<!DOCTYPE html> کتابخانه پدیا بایبل - مطالعه کتاب‌ها و مقالات

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

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

لطفاً یک کتاب یا مقاله از لیست انتخاب کنید