تست: تفاوت میان نسخهها
ظاهر
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
خط ۱: | خط ۱: | ||
<!DOCTYPE html> | |||
<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> | <style> | ||
body { | |||
font-family: Tahoma, Arial, sans-serif; | |||
background-color: #f6f6f6; | |||
margin: 0; | margin: 0; | ||
padding: | padding: 20px; | ||
color: #333; | |||
color: # | |||
} | } | ||
.container { | .container { | ||
max-width: | max-width: 1200px; | ||
margin: 0 auto; | margin: 0 auto; | ||
padding: | background: white; | ||
padding: 20px; | |||
border-radius: 8px; | |||
box-shadow: 0 0 10px rgba(0,0,0,0.1); | |||
} | } | ||
h1 { | |||
text-align: center; | |||
color: #2c3e50; | |||
margin-bottom: 30px; | |||
} | } | ||
.search-section { | |||
. | margin-bottom: 30px; | ||
margin: | padding: 20px; | ||
background: #f8f9fa; | |||
border-radius: 8px; | |||
border: 1px solid #dee2e6; | |||
} | } | ||
.form-group { | |||
. | margin-bottom: 15px; | ||
} | } | ||
label { | |||
display: block; | |||
margin-bottom: 5px; | |||
font-weight: bold; | |||
color: #495057; | |||
} | } | ||
select, input[type="text"] { | |||
width: 100%; | |||
padding: 10px; | |||
border: 1px solid #ced4da; | |||
border-radius: 4px; | |||
font-size: 16px; | |||
box-sizing: border-box; | |||
} | } | ||
button { | |||
background-color: #007bff; | |||
color: white; | |||
padding: 10px 20px; | |||
border: none; | |||
border-radius: 4px; | |||
cursor: pointer; | |||
font-size: 16px; | |||
margin: 5px; | |||
} | } | ||
button:hover { | |||
background-color: #0056b3; | |||
} | } | ||
.button-group { | |||
display: flex; | |||
. | justify-content: flex-start; | ||
display: | flex-wrap: wrap; | ||
margin-top: 10px; | |||
} | } | ||
.iframe-container { | |||
. | margin-top: 20px; | ||
border: 1px solid #dee2e6; | |||
border-radius: 8px; | |||
border: | |||
overflow: hidden; | overflow: hidden; | ||
} | } | ||
iframe { | |||
width: 100%; | |||
height: 600px; | |||
border: none; | border: none; | ||
} | } | ||
.help-text { | |||
. | font-size: 14px; | ||
color: #6c757d; | |||
margin-top: 5px; | |||
} | } | ||
.create-new { | |||
background-color: #28a745; | |||
} | } | ||
.create-new:hover { | |||
background-color: #218838; | |||
} | } | ||
</style> | </style> | ||
</head> | </head> | ||
<body> | <body> | ||
<div class="container"> | <div class="container"> | ||
<h1>کتابخانه پدیا بایبل</h1> | |||
< | |||
<div class="search-section"> | |||
<div class="form-group"> | |||
<label for="bookSelect">انتخاب کتاب از لیست:</label> | |||
<select id="bookSelect"> | |||
<option value="">-- لطفاً یک کتاب انتخاب کنید --</option> | |||
<option value="کتاب_اول">کتاب اول</option> | |||
<option value="کتاب_دوم">کتاب دوم</option> | |||
<option value="کتاب_سوم">کتاب سوم</option> | |||
<option value="انجیل">انجیل</option> | |||
<option value="تورات">تورات</option> | |||
<!-- میتوانید کتابهای بیشتری به این لیست اضافه کنید --> | |||
</select> | |||
</div> | |||
<div class="form-group"> | |||
<label for="bookSearch">یا جستجوی کتاب جدید:</label> | |||
<input type="text" id="bookSearch" placeholder="نام کتاب را وارد کنید..."> | |||
<div class="help-text">اگر کتاب مورد نظر در لیست بالا نیست، نام آن را در اینجا وارد کنید</div> | |||
</div> | |||
< | |||
<div class="button-group"> | |||
< | <button id="showBook">نمایش کتاب</button> | ||
<button id="createNew" class="create-new">ایجاد صفحه جدید</button> | |||
< | |||
< | |||
< | |||
< | |||
< | |||
< | |||
< | |||
</div> | </div> | ||
</ | </div> | ||
<div class="iframe-container"> | |||
<iframe id="contentFrame" src="about:blank"></iframe> | |||
</div> | |||
</div> | </div> | ||
<script> | <script> | ||
document.addEventListener('DOMContentLoaded', function() { | document.addEventListener('DOMContentLoaded', function() { | ||
const | const bookSelect = document.getElementById('bookSelect'); | ||
const bookSearch = document.getElementById('bookSearch'); | |||
const showBookBtn = document.getElementById('showBook'); | |||
const createNewBtn = document.getElementById('createNew'); | |||
const contentFrame = document.getElementById('contentFrame'); | |||
// هنگام تغییر در select، مقدار جستجو را به روز میکند | |||
bookSelect.addEventListener('change', function() { | |||
if (this.value) { | |||
bookSearch.value = this.options[this.selectedIndex].text; | |||
} | |||
}); | |||
// هنگام تغییر در جستجو، select را ریست میکند | |||
bookSearch.addEventListener('input', function() { | |||
bookSelect.selectedIndex = 0; | |||
}); | |||
// نمایش کتاب انتخاب شده | |||
showBookBtn.addEventListener('click', function() { | |||
let bookName = bookSearch.value.trim(); | |||
if (!bookName) { | |||
bookName = bookSelect.value; | |||
} | |||
if (bookName) { | |||
const encodedBookName = encodeURIComponent(bookName); | |||
contentFrame.src = `https://www.pediabible.com/index.php/${encodedBookName}`; | |||
} else { | |||
alert('لطفاً نام کتاب را انتخاب یا وارد کنید'); | |||
} | |||
}); | |||
// ایجاد صفحه جدید برای کتاب | |||
createNewBtn.addEventListener('click', function() { | |||
let bookName = bookSearch.value.trim(); | |||
if (!bookName) { | |||
alert('لطفاً نام کتاب را وارد کنید'); | |||
return; | |||
} | |||
const encodedBookName = encodeURIComponent(bookName); | |||
const newPageUrl = `https://www.pediabible.com/index.php/${encodedBookName}`; | |||
// باز کردن صفحه جدید در تب جدید | |||
window.open(newPageUrl, '_blank'); | |||
// همچنین محتوای صفحه را در iframe نمایش میدهد | |||
contentFrame.src = newPageUrl; | |||
}); | }); | ||
}); | }); |
نسخهٔ ۱۲ اکتبر ۲۰۲۵، ساعت ۱۷:۲۴
<!DOCTYPE html>
کتابخانه پدیا بایبل
اگر کتاب مورد نظر در لیست بالا نیست، نام آن را در اینجا وارد کنید