کتاب مقدس آنلاین: تفاوت میان نسخهها
ظاهر
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
| خط ۳۰: | خط ۳۰: | ||
padding: 0; | padding: 0; | ||
margin: 0; | margin: 0; | ||
} | |||
/* مخفی کردن هدرهای اضافی ویکی */ | |||
body > header:first-child, | |||
.wiki-header, | |||
.mw-header, | |||
#mw-header, | |||
#header, | |||
.header { | |||
display: none !important; | |||
} | } | ||
| خط ۱۷۳: | خط ۱۸۳: | ||
.content-display { | .content-display { | ||
width: 100%; | width: 100%; | ||
height: 650px; | |||
border: 1px solid var(--border-color); | border: 1px solid var(--border-color); | ||
border-radius: 6px; | border-radius: 6px; | ||
background: white; | background: white; | ||
} | } | ||
| خط ۳۵۳: | خط ۳۲۰: | ||
.content-display { | .content-display { | ||
height: 500px; | |||
} | } | ||
| خط ۳۶۹: | خط ۳۳۴: | ||
} | } | ||
@media (max-width: 480px) { | |||
.content-display { | |||
height: 450px; | |||
} | |||
.nav-btn, .wiki-link { | |||
padding: 10px 15px; | |||
font-size: 0.9rem; | |||
} | |||
.instructions { | |||
padding: 30px 15px; | |||
font-size: 1rem; | |||
} | |||
.app-header { | |||
padding: 10px 12px; | |||
} | |||
.app-header h1 { | |||
font-size: 1.3rem; | |||
} | |||
} | |||
/* استایل برای حالت انتخاب نشده */ | |||
.placeholder { | .placeholder { | ||
display: flex; | display: flex; | ||
| خط ۳۸۵: | خط ۳۷۵: | ||
} | } | ||
/* استایل برای راستچین کامل */ | |||
option { | option { | ||
direction: rtl; | direction: rtl; | ||
| خط ۴۱۷: | خط ۴۰۸: | ||
]; | ]; | ||
// تابع بررسی مجاز بودن دامنه | |||
function isDomainAllowed() { | function isDomainAllowed() { | ||
const currentDomain = window.location.hostname; | const currentDomain = window.location.hostname; | ||
console.log('🔍 بررسی دامنه:', currentDomain); | |||
// اگر روی فایل محلی هستیم، اجازه بده | |||
if (!currentDomain || currentDomain === '' || currentDomain === 'null') { | if (!currentDomain || currentDomain === '' || currentDomain === 'null') { | ||
console.log('✅ فایل محلی - مجاز'); | |||
return true; | return true; | ||
} | } | ||
const isAllowed = ALLOWED_DOMAINS.some(domain => { | |||
const match = currentDomain === domain || currentDomain.endsWith('.' + domain); | |||
if (match) { | |||
console.log(`✅ دامنه ${currentDomain} مجاز است`); | |||
} | |||
return match; | |||
}); | }); | ||
if (!isAllowed) { | |||
console.log(`❌ دامنه ${currentDomain} غیرمجاز است`); | |||
} | |||
return isAllowed; | |||
} | } | ||
// تابع نمایش پیام دسترسی غیرمجاز | |||
function showAccessDenied() { | function showAccessDenied() { | ||
const wrapper = document.getElementById('content-wrapper'); | const wrapper = document.getElementById('content-wrapper'); | ||
| خط ۴۳۳: | خط ۴۴۱: | ||
<h3><i class="fas fa-ban"></i> دسترسی محدود شده</h3> | <h3><i class="fas fa-ban"></i> دسترسی محدود شده</h3> | ||
<p>این صفحه فقط بر روی دامنه <strong>pediabible.com</strong> قابل دسترسی است.</p> | <p>این صفحه فقط بر روی دامنه <strong>pediabible.com</strong> قابل دسترسی است.</p> | ||
<p>دامنه فعلی: <code>${window.location.hostname}</code></p> | |||
<p>لطفاً از <a href="https://www.pediabible.com" style="color: #721c24; text-decoration: underline;">سایت اصلی</a> بازدید کنید.</p> | <p>لطفاً از <a href="https://www.pediabible.com" style="color: #721c24; text-decoration: underline;">سایت اصلی</a> بازدید کنید.</p> | ||
</div> | </div> | ||
`; | `; | ||
} | |||
// تابع اصلی بارگذاری برنامه | |||
function loadApplication() { | |||
console.log('🚀 شروع بارگذاری با بررسی امنیتی...'); | |||
if (!isDomainAllowed()) { | |||
console.log('❌ دسترسی غیرمجاز - نمایش پیام خطا'); | |||
showAccessDenied(); | |||
return; | |||
} | |||
console.log('✅ دامنه مجاز - بارگذاری برنامه اصلی'); | |||
// اگر دامنه مجاز باشد، برنامه اصلی بارگذاری میشود | |||
initializeBibleApp(); | |||
} | } | ||
| خط ۴۸۶: | خط ۵۱۰: | ||
{ name: "لوقا", chapters: 24, displayName: "انجیل به قلم لوقا" }, | { name: "لوقا", chapters: 24, displayName: "انجیل به قلم لوقا" }, | ||
{ name: "یوحنا", chapters: 21, displayName: "انجیل به قلم یوحنا" }, | { name: "یوحنا", chapters: 21, displayName: "انجیل به قلم یوحنا" }, | ||
{ name: "اعمال", chapters: 28, displayName: "اعمال" }, | { name: "اعمال ", chapters: 28, displayName: "اعمال " }, | ||
{ name: "رومیان", chapters: 16, displayName: "رساله به رومیان" }, | { name: "رومیان", chapters: 16, displayName: "رساله به رومیان" }, | ||
{ name: "اول قرنتیان", chapters: 16, displayName: "رساله اول به قرنتیان" }, | { name: "اول قرنتیان", chapters: 16, displayName: "رساله اول به قرنتیان" }, | ||
| خط ۵۰۸: | خط ۵۳۲: | ||
{ name: "سوم یوحنا", chapters: 1, displayName: "رساله سوم یوحنا" }, | { name: "سوم یوحنا", chapters: 1, displayName: "رساله سوم یوحنا" }, | ||
{ name: "یهودا", chapters: 1, displayName: "رساله یهودا" }, | { name: "یهودا", chapters: 1, displayName: "رساله یهودا" }, | ||
{ name: "کتاب مکاشفه", chapters: 22, displayName: "کتاب مکاشفه" } | { name: "کتاب مکاشفه", chapters: 22, displayName: "کتاب مکاشفه " } | ||
] | ] | ||
}; | }; | ||
| خط ۵۱۶: | خط ۵۴۰: | ||
const wrapper = document.getElementById('content-wrapper'); | const wrapper = document.getElementById('content-wrapper'); | ||
// ایجاد ساختار HTML برنامه | |||
wrapper.innerHTML = ` | wrapper.innerHTML = ` | ||
<div class="selector-container"> | <div class="selector-container"> | ||
| خط ۵۸۴: | خط ۶۰۹: | ||
`; | `; | ||
// دادههای ترجمههای مختلف | |||
const translations = { | const translations = { | ||
'old': { | 'old': { | ||
name: 'ترجمه قدیم', | name: 'ترجمه قدیم', | ||
baseUrl: 'https://www.pediabible.com/index.php?title=', | baseUrl: 'https://www.pediabible.com/index.php?title=', | ||
// برای ترجمه قدیم از الگوی ساده با displayName استفاده میکنیم | |||
getPageTitle: function(bookDisplayName, chapter) { | getPageTitle: function(bookDisplayName, chapter) { | ||
return `${bookDisplayName} فصل ${chapter}`; | return `${bookDisplayName} فصل ${chapter}`; | ||
| خط ۵۹۵: | خط ۶۲۲: | ||
name: 'هزاره نو', | name: 'هزاره نو', | ||
baseUrl: 'https://www.pediabible.com/index.php?title=', | baseUrl: 'https://www.pediabible.com/index.php?title=', | ||
// برای ترجمههای جدید از displayName + نام ترجمه استفاده میکنیم | |||
getPageTitle: function(bookDisplayName, chapter) { | getPageTitle: function(bookDisplayName, chapter) { | ||
return `${bookDisplayName} هزاره نو فصل ${chapter}`; | return `${bookDisplayName} هزاره نو فصل ${chapter}`; | ||
| خط ۶۱۵: | خط ۶۴۳: | ||
}; | }; | ||
// عناصر DOM | |||
const translationSelect = document.getElementById('translation-select'); | const translationSelect = document.getElementById('translation-select'); | ||
const testamentSelect = document.getElementById('testament-select'); | const testamentSelect = document.getElementById('testament-select'); | ||
| خط ۶۲۵: | خط ۶۵۴: | ||
const wikiPageLink = document.getElementById('wiki-page-link'); | const wikiPageLink = document.getElementById('wiki-page-link'); | ||
// متغیرهای وضعیت فعلی | |||
let currentTranslation = ''; | let currentTranslation = ''; | ||
let currentTestament = ''; | let currentTestament = ''; | ||
| خط ۶۳۰: | خط ۶۶۰: | ||
let currentChapter = 1; | let currentChapter = 1; | ||
// رویداد تغییر ترجمه | |||
translationSelect.addEventListener('change', function() { | translationSelect.addEventListener('change', function() { | ||
currentTranslation = this.value; | currentTranslation = this.value; | ||
| خط ۶۴۶: | خط ۶۷۷: | ||
}); | }); | ||
// رویداد تغییر عهد | |||
testamentSelect.addEventListener('change', function() { | testamentSelect.addEventListener('change', function() { | ||
currentTestament = this.value; | currentTestament = this.value; | ||
| خط ۶۷۲: | خط ۷۰۴: | ||
}); | }); | ||
// رویداد تغییر کتاب | |||
bookSelect.addEventListener('change', function() { | bookSelect.addEventListener('change', function() { | ||
currentBook = this.value; | currentBook = this.value; | ||
| خط ۶۹۹: | خط ۷۳۲: | ||
}); | }); | ||
// رویداد تغییر فصل | |||
chapterSelect.addEventListener('change', function() { | chapterSelect.addEventListener('change', function() { | ||
currentChapter = parseInt(this.value); | currentChapter = parseInt(this.value); | ||
if (currentChapter) { | if (currentChapter) { | ||
displayChapterWithIframe(); | |||
} else { | } else { | ||
resetContent(); | resetContent(); | ||
| خط ۷۰۹: | خط ۷۴۳: | ||
}); | }); | ||
// | // نمایش فصل با iframe - فقط محتوای اصلی | ||
function displayChapterWithIframe() { | |||
const bookIndex = parseInt(currentBook); | |||
const bookData = bibleBooks[currentTestament][bookIndex]; | |||
const bookName = bookData.name; | |||
const bookDisplayName = bookData.displayName; | |||
const translationName = translations[currentTranslation].name; | |||
chapterTitle.textContent = `${translationName} - ${bookName} - فصل ${currentChapter}`; | |||
// استفاده از الگوی مناسب برای هر ترجمه | |||
const pageTitle = translations[currentTranslation].getPageTitle(bookDisplayName, currentChapter); | |||
// استفاده از action=render برای نمایش فقط محتوای اصلی | |||
const contentUrl = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}&action=render`; | |||
// نمایش | |||
versesContainer.innerHTML = ` | versesContainer.innerHTML = ` | ||
< | <iframe | ||
id="content-iframe" | |||
src="${contentUrl}" | |||
</ | class="content-display" | ||
frameborder="0" | |||
loading="lazy" | |||
allowfullscreen> | |||
</iframe> | |||
`; | `; | ||
// لینک صفحه کامل برای باز کردن در تب جدید | |||
wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`; | |||
// لینک صفحه کامل | |||
wikiPageLink.href = ` | |||
wikiPageLink.style.display = 'flex'; | wikiPageLink.style.display = 'flex'; | ||
updateNavigationButtons(); | |||
} | } | ||
| خط ۸۶۰: | خط ۷۸۸: | ||
currentChapter--; | currentChapter--; | ||
chapterSelect.value = currentChapter; | chapterSelect.value = currentChapter; | ||
displayChapterWithIframe(); | |||
} | } | ||
}); | }); | ||
| خط ۸۷۱: | خط ۷۹۹: | ||
currentChapter++; | currentChapter++; | ||
chapterSelect.value = currentChapter; | chapterSelect.value = currentChapter; | ||
displayChapterWithIframe(); | |||
} | } | ||
}); | }); | ||
| خط ۸۹۲: | خط ۸۲۰: | ||
function resetAll() { | function resetAll() { | ||
testamentSelect.disabled = true; | testamentSelect.disabled = true; | ||
testamentSelect.value = | testamentSelect.innerHTML = '<option value="">انتخاب عهد</option>'; | ||
bookSelect.disabled = true; | bookSelect.disabled = true; | ||
bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>'; | bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>'; | ||
| خط ۸۹۹: | خط ۸۲۷: | ||
resetContent(); | resetContent(); | ||
} | } | ||
console.log('✅ برنامه کتاب مقدس روی دامنه مجاز بارگذاری شد'); | |||
} | } | ||
// شروع برنامه | // 🔒 شروع برنامه با بررسی امنیتی | ||
document.addEventListener('DOMContentLoaded', function() { | document.addEventListener('DOMContentLoaded', function() { | ||
console.log('🚀 شروع بارگذاری با بررسی امنیتی...'); | |||
loadApplication(); | |||
}); | |||
// 🔒 جلوگیری از دسترسی به توابع از کنسول | |||
Object.defineProperty(window, 'translations', { | |||
value: null, | |||
writable: false, | |||
configurable: false | |||
}); | }); | ||
</script> | </script> | ||
</body> | </body> | ||
</html> | </html> | ||