تست: تفاوت میان نسخهها
ظاهر
جایگزینی صفحه با '<!DOCTYPE html> <html lang="fa" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>منوی انتخاب سفارشی</title> <style> body { font-family: sans-serif; background: #f2f2f2; padding: 40px; } .custom-select { position: relative; width: 250px; background: #fff; border: 1px solid #ccc; border-radius: 8px; cursor: pointer; user-select: none; } .selected-option {...' برچسب: جایگزین شد |
بدون خلاصۀ ویرایش |
||
خط ۲: | خط ۲: | ||
<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> | ||
<style> | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | ||
body { | <style> | ||
* { | |||
margin: 0; | |||
padding: 0; | |||
} | box-sizing: border-box; | ||
.custom-select { | } | ||
:root { | |||
--primary-color: #2c5530; | |||
--secondary-color: #4a7c59; | |||
--accent-color: #8fb996; | |||
--light-color: #f8f9fa; | |||
--dark-color: #343a40; | |||
} | --text-color: #333; | ||
. | --border-color: #dee2e6; | ||
--shadow: 0 4px 12px rgba(0,0,0,0.1); | |||
} | --transition: all 0.3s ease; | ||
. | } | ||
body { | |||
font-family: 'Segoe UI', Tahoma, Arial, sans-serif; | |||
background: #f0f2f5; | |||
color: var(--text-color); | |||
line-height: 1.6; | |||
padding: 10px; | |||
min-height: 100vh; | |||
} | |||
} | .container { | ||
. | max-width: 1200px; | ||
margin: 0 auto; | |||
background: white; | |||
} | padding: 15px; | ||
. | border-radius: 8px; | ||
box-shadow: 0 2px 10px rgba(0,0,0,0.05); | |||
} | } | ||
. | |||
.header { | |||
} | background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); | ||
</style> | color: white; | ||
padding: 20px; | |||
border-radius: 8px; | |||
margin-bottom: 20px; | |||
text-align: center; | |||
} | |||
h1 { | |||
margin: 0; | |||
font-size: 24px; | |||
font-weight: 700; | |||
} | |||
.description { | |||
color: rgba(255,255,255,0.9); | |||
font-size: 14px; | |||
margin-top: 8px; | |||
} | |||
.stats-bar { | |||
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; | |||
} | |||
.stat-item { | |||
display: flex; | |||
align-items: center; | |||
gap: 6px; | |||
} | |||
.stat-value { | |||
font-weight: bold; | |||
color: var(--primary-color); | |||
} | |||
.filter-section { | |||
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 { | |||
display: block; | |||
margin-bottom: 6px; | |||
font-weight: 600; | |||
color: var(--dark-color); | |||
font-size: 14px; | |||
} | |||
.custom-select-container { | |||
position: relative; | |||
} | |||
.custom-select { | |||
width: 100%; | |||
padding: 10px 12px; | |||
border: 1px solid var(--border-color); | |||
border-radius: 6px; | |||
font-size: 14px; | |||
background: white; | |||
cursor: pointer; | |||
text-align: right; | |||
transition: var(--transition); | |||
display: flex; | |||
align-items: center; | |||
justify-content: space-between; | |||
} | |||
.custom-select:hover { | |||
border-color: var(--accent-color); | |||
} | |||
.custom-select.active { | |||
border-color: var(--primary-color); | |||
} | |||
.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; | |||
} | |||
.search-box { | |||
padding: 10px; | |||
border-bottom: 1px solid var(--border-color); | |||
background: var(--light-color); | |||
} | |||
.search-box input { | |||
width: 100%; | |||
padding: 8px 10px; | |||
border: 1px solid var(--border-color); | |||
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; | |||
} | |||
.content-section { | |||
margin-top: 15px; | |||
border: 1px solid var(--border-color); | |||
border-radius: 8px; | |||
overflow: hidden; | |||
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; | |||
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; | |||
font-size: 12px; | |||
transition: var(--transition); | |||
display: flex; | |||
align-items: center; | |||
gap: 4px; | |||
} | |||
.control-btn:hover { | |||
background: var(--light-color); | |||
} | |||
.iframe-container { | |||
width: 100%; | |||
flex: 1; | |||
position: relative; | |||
} | |||
.clean-frame { | |||
width: 100%; | |||
height: 100%; | |||
border: none; | |||
background: white; | |||
} | |||
.iframe-placeholder { | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
height: 100%; | |||
color: #6c757d; | |||
font-size: 15px; | |||
text-align: center; | |||
padding: 15px; | |||
background: white; | |||
flex-direction: column; | |||
} | |||
.action-buttons { | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
padding: 12px 15px; | |||
background-color: var(--light-color); | |||
border-top: 1px solid var(--border-color); | |||
gap: 10px; | |||
} | |||
.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; | |||
transition: var(--transition); | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
gap: 6px; | |||
} | |||
.site-link { | |||
background: #6c757d; | |||
} | |||
.view-link { | |||
background: var(--secondary-color); | |||
} | |||
.site-link:hover, .wiki-link:hover, .view-link:hover { | |||
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); | |||
} | |||
.section-title { | |||
font-size: 16px; | |||
font-weight: 600; | |||
color: var(--primary-color); | |||
margin-bottom: 12px; | |||
display: flex; | |||
align-items: center; | |||
gap: 8px; | |||
} | |||
.recent-items { | |||
display: flex; | |||
gap: 10px; | |||
overflow-x: auto; | |||
padding: 5px; | |||
} | |||
.recent-item { | |||
background: white; | |||
border-radius: 6px; | |||
padding: 12px; | |||
min-width: 150px; | |||
border: 1px solid var(--border-color); | |||
cursor: pointer; | |||
transition: var(--transition); | |||
text-align: center; | |||
} | |||
.recent-item:hover { | |||
transform: translateY(-2px); | |||
box-shadow: 0 2px 5px rgba(0,0,0,0.1); | |||
} | |||
.recent-title { | |||
font-weight: 600; | |||
font-size: 13px; | |||
color: var(--dark-color); | |||
} | |||
.recent-category { | |||
font-size: 11px; | |||
color: #6c757d; | |||
margin-top: 4px; | |||
} | |||
.empty-recent { | |||
text-align: center; | |||
color: #6c757d; | |||
padding: 15px; | |||
font-style: italic; | |||
width: 100%; | |||
} | |||
.loading-bar { | |||
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; | |||
} | |||
.recent-item { | |||
min-width: auto; | |||
} | |||
} | |||
</style> | |||
</head> | </head> | ||
<body> | <body> | ||
<div class="container"> | |||
<div class="header"> | |||
<h1>کتابخانه پدیا بایبل</h1> | |||
<div class="description"> | |||
در این بخش میتوانید کتابها و مقالات مختلف را مطالعه کنید. | |||
برای شروع، دستهبندی و سپس مورد مورد نظر خود را انتخاب نمایید. | |||
</div> | |||
</div> | |||
<div class="stats-bar"> | |||
<div class="stat-item"> | |||
<i class="fas fa-book"></i> | |||
<span>تعداد کتابها: <span class="stat-value" id="booksCount">4</span></span> | |||
</div> | |||
<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 class="form-group"> | |||
<label for="bookSelect">انتخاب محتوا:</label> | |||
<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="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 class="loading-bar" id="loadingBar"></div> | |||
<div class="iframe-container"> | |||
<div class="iframe-placeholder" id="iframePlaceholder"> | |||
<div> | |||
<i class="fas fa-book-open" style="font-size: 2.5rem; color: #6c757d; margin-bottom: 10px;"></i> | |||
<p>لطفاً یک کتاب یا مقاله از لیست انتخاب کنید</p> | |||
</div> | |||
</div> | |||
<iframe id="contentFrame" class="clean-frame" src="about:blank" style="display: none;"></iframe> | |||
</div> | |||
<div class="action-buttons"> | |||
<a id="siteLink" href="#" class="site-link" target="_blank" style="display: none;"> | |||
<i class="fas fa-external-link-alt"></i> | |||
مشاهده صفحه در سایت اصلی | |||
</a> | |||
<a id="wikiLink" href="#" class="wiki-link" target="_blank" style="display: none;"> | |||
<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> | |||
<div class="recent-section"> | |||
<div class="section-title"> | |||
<i class="fas fa-history"></i> | |||
مطالب مطالعه شده اخیر | |||
</div> | |||
<div class="recent-items" id="recentItems"> | |||
<div class="empty-recent">هیچ مطلبی اخیراً مطالعه نشده است</div> | |||
</div> | |||
</div> | |||
</div> | |||
< | <script> | ||
const booksData = { | |||
'کتاب': [ | |||
{ value: 'عیسی', text: 'عیسی' }, | |||
{ value: 'انجیل_متی', text: 'انجیل متی' }, | |||
{ value: 'مزامیر', text: 'مزامیر' }, | |||
{ value: 'پیدایش', text: 'پیدایش' } | |||
], | |||
'مقاله': [ | |||
{ value: 'مسیح', text: 'مسیح' }, | |||
{ value: 'تثلیث', text: 'تثلیث' }, | |||
{ value: 'نجات', text: 'نجات' }, | |||
{ value: 'روح_القدس', text: 'روح القدس' } | |||
] | |||
}; | |||
const elements = { | |||
categorySelect: document.getElementById('categorySelect'), | |||
customSelectDisplay: document.getElementById('customSelectDisplay'), | |||
} | customDropdown: document.getElementById('customDropdown'), | ||
dropdownSearch: document.getElementById('dropdownSearch'), | |||
optionsContainer: document.getElementById('optionsContainer'), | |||
contentFrame: document.getElementById('contentFrame'), | |||
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() { | |||
elements.customDropdown.classList.remove('show'); | |||
elements.customSelectDisplay.classList.remove('active'); | |||
}); | |||
elements.customDropdown.addEventListener('click', function(e) { | |||
e.stopPropagation(); | |||
}); | |||
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() { | |||
elements.booksCount.textContent = booksData['کتاب'].length; | |||
elements.articlesCount.textContent = booksData['مقاله'].length; | |||
elements.readCount.textContent = readItems.length; | |||
} | |||
function updateRecentItems() { | |||
if (readItems.length === 0) { | |||
elements.recentItems.innerHTML = '<div class="empty-recent">هیچ مطلبی اخیراً مطالعه نشده است</div>'; | |||
return; | |||
} | |||
elements.recentItems.innerHTML = ''; | |||
const recentToShow = readItems.slice(-5).reverse(); | |||
recentToShow.forEach(item => { | |||
const recentItem = document.createElement('div'); | |||
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() { | |||
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]) { | |||
elements.optionsContainer.innerHTML = '<div class="option-item" style="color:#999;">دستهبندی نامعتبر است</div>'; | |||
return; | |||
} | |||
const books = booksData[currentCategory]; | |||
const searchLower = searchTerm.toLowerCase().trim(); | |||
elements.optionsContainer.innerHTML = ''; | |||
const filteredBooks = books.filter(book => | |||
book.text.toLowerCase().includes(searchLower) | |||
); | |||
if (filteredBooks.length === 0) { | |||
const noResult = document.createElement('div'); | |||
noResult.className = 'option-item'; | |||
noResult.textContent = 'نتیجهای یافت نشد'; | |||
noResult.style.color = '#999'; | |||
elements.optionsContainer.appendChild(noResult); | |||
return; | |||
} | |||
filteredBooks.forEach(book => { | |||
const optionItem = document.createElement('div'); | |||
optionItem.className = 'option-item'; | |||
optionItem.textContent = book.text; | |||
optionItem.dataset.value = book.value; | |||
optionItem.dataset.text = book.text; | |||
if (book.value === currentSelection.value) { | |||
optionItem.classList.add('selected'); | |||
} | |||
optionItem.addEventListener('click', () => { | |||
const value = optionItem.dataset.value; | |||
const text = optionItem.dataset.text; | |||
currentSelection = { value, text }; | |||
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) { | |||
if (!bookValue || !bookText) { | |||
resetContent(); | |||
return; | |||
} | |||
const newItem = { value: bookValue, text: bookText, category: currentCategory }; | |||
if (!readItems.some(item => item.value === bookValue && item.category === currentCategory)) { | |||
readItems.push(newItem); | |||
localStorage.setItem('readItems', JSON.stringify(readItems)); | |||
updateStats(); | |||
updateRecentItems(); | |||
} | |||
// ✅ URL بدون فاصله اضافه | |||
const baseUrl = 'https://www.pediabible.com/index.php/'; | |||
const contentUrl = `${baseUrl}${bookValue}?action=render`; | |||
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() { | |||
elements.contentFrame.style.zoom = `${currentZoom}%`; | |||
} | |||
init(); | |||
</script> | |||
</body> | </body> | ||
</html> | </html> |
نسخهٔ ۱۲ اکتبر ۲۰۲۵، ساعت ۲۲:۰۲
<!DOCTYPE html>
کتابخانه پدیا بایبل
در این بخش میتوانید کتابها و مقالات مختلف را مطالعه کنید.
برای شروع، دستهبندی و سپس مورد مورد نظر خود را انتخاب نمایید.
ابتدا دستهبندی را انتخاب کنید
هیچ محتوایی انتخاب نشده است
لطفاً یک کتاب یا مقاله از لیست انتخاب کنید
مطالب مطالعه شده اخیر
هیچ مطلبی اخیراً مطالعه نشده است