پرش به محتوا

کتاب مقدس آنلاین: تفاوت میان نسخه‌ها

از دانشنامه کتاب مقدس
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
برچسب: برگردانده‌شده
خط ۱: خط ۱:
<!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>تست لینک‌های iframe</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
     <style>
     <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #8B4513;
            --accent-color: #A52A2A;
            --light-color: #f8f5f2;
            --dark-color: #3E2723;
            --border-color: #D2B48C;
            --font-family: 'Times New Roman', serif;
        }
       
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
       
         body {
         body {
             font-family: var(--font-family);
             font-family: Tahoma, sans-serif;
             background-color: #f5f1eb;
             background: #f5f5f5;
            color: var(--dark-color);
             padding: 20px;
            line-height: 1.6;
             text-align: center;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><path fill="%238B4513" d="M20,20 L80,20 L80,80 L20,80 Z" stroke="%238B4513" stroke-width="2"/></svg>');
             padding: 0;
             margin: 0;
        }
       
        /* مخفی کردن هدرهای اضافی ویکی */
        body > header:first-child,
        .wiki-header,
        .mw-header,
        #mw-header,
        #header,
        .header {
            display: none !important;
         }
         }
       
         .container {
         .container {
             max-width: 1200px;
             max-width: 800px;
             margin: 0 auto;
             margin: 0 auto;
            padding: 5px 15px;
        }
       
        .app-header {
            text-align: center;
            margin-bottom: 20px;
            padding: 15px 20px;
            border-bottom: 2px solid var(--border-color);
            background: linear-gradient(to bottom, #f9f6f2, #f0e6d6);
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            position: relative;
        }
       
        .breadcrumb {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
            font-size: 0.9rem;
            color: var(--dark-color);
            direction: rtl;
        }
       
        .breadcrumb-home {
            color: var(--accent-color);
            text-decoration: none;
            transition: color 0.3s;
            font-weight: 500;
        }
       
        .breadcrumb-home:hover {
            color: var(--primary-color);
            text-decoration: underline;
        }
       
        .breadcrumb-separator {
            color: var(--border-color);
            font-weight: 300;
        }
       
        .breadcrumb-current {
            color: var(--primary-color);
            font-weight: bold;
        }
       
        .app-header h1 {
            color: var(--primary-color);
            margin-bottom: 8px;
            font-size: 1.8rem;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
            font-weight: 700;
            text-align: center;
        }
       
        .description {
            color: var(--accent-color);
            font-size: 1rem;
            font-style: italic;
            margin-top: 5px;
            text-align: center;
        }
       
        .selector-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
            background: white;
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.08);
            border: 1px solid var(--border-color);
            direction: rtl;
            text-align: right;
        }
       
        .selector-box {
            background: white;
            border-radius: 6px;
            padding: 12px;
            border: 1px solid var(--border-color);
        }
       
        .selector-title {
            font-size: 1rem;
            margin-bottom: 8px;
            color: var(--primary-color);
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 5px;
            text-align: center;
        }
       
        select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            background-color: white;
            font-size: 0.95rem;
            color: var(--dark-color);
            cursor: pointer;
            transition: all 0.3s;
            font-family: var(--font-family);
            text-align: right;
            direction: rtl;
        }
       
        select:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(165, 42, 42, 0.2);
        }
       
        .bible-content {
             background: white;
             background: white;
             border-radius: 8px;
            padding: 20px;
             box-shadow: 0 4px 12px rgba(0,0,0,0.1);
             border-radius: 10px;
            padding: 25px;
             box-shadow: 0 0 10px rgba(0,0,0,0.1);
            min-height: 500px;
            border: 1px solid var(--border-color);
            margin-bottom: 20px;
            direction: rtl;
            text-align: right;
         }
         }
          
         iframe {
        .chapter-title {
            text-align: center;
            margin-bottom: 20px;
            color: var(--primary-color);
            font-size: 1.5rem;
            padding-bottom: 10px;
            border-bottom: 2px solid var(--border-color);
        }
       
        .content-display {
             width: 100%;
             width: 100%;
             height: 650px;
             height: 300px;
             border: 1px solid var(--border-color);
             border: 2px solid #3498db;
             border-radius: 6px;
             border-radius: 5px;
             background: white;
             margin: 20px 0;
         }
         }
          
         button {
        .navigation {
             background: #3498db;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 25px;
            flex-wrap: wrap;
            gap: 10px;
            direction: rtl;
        }
       
        .nav-btn {
            padding: 12px 20px;
             background-color: var(--secondary-color);
             color: white;
             color: white;
             border: none;
             border: none;
             border-radius: 6px;
            padding: 10px 20px;
             border-radius: 5px;
             cursor: pointer;
             cursor: pointer;
             transition: all 0.3s;
             margin: 10px;
            font-size: 1rem;
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: var(--font-family);
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
       
        .nav-btn:hover {
            background-color: var(--accent-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
         }
         }
       
         .result {
         .nav-btn:disabled {
            background-color: #b0a090;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
 
        .wiki-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 12px 20px;
            background-color: var(--accent-color);
            color: white;
            text-decoration: none;
            border-radius: 6px;
            transition: all 0.3s;
            font-size: 1rem;
            font-family: var(--font-family);
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
 
        .wiki-link:hover {
            background-color: #8B0000;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
 
        .instructions {
            text-align: center;
            color: #7f8c8d;
            padding: 40px 20px;
            border: 2px dashed var(--border-color);
            border-radius: 8px;
             margin-top: 20px;
             margin-top: 20px;
             font-size: 1.1rem;
             padding: 15px;
             background-color: var(--light-color);
            border-radius: 5px;
             background: #f8f9fa;
         }
         }
 
         .success {
         .access-denied {
             background: #d4edda;
            text-align: center;
             color: #155724;
            padding: 40px;
             border: 1px solid #c3e6cb;
             background: #fee;
             border-radius: 8px;
             border: 2px solid #f5c6cb;
            color: #721c24;
            margin-top: 20px;
         }
         }
 
         .error {
         .access-denied h3 {
            background: #f8d7da;
             color: #721c24;
             color: #721c24;
             margin-bottom: 15px;
             border: 1px solid #f5c6cb;
            font-size: 1.5rem;
        }
 
        /* استایل‌های مخصوص موبایل */
        @media (max-width: 768px) {
            .container {
                padding: 8px 10px;
            }
           
            .app-header {
                margin-bottom: 15px;
                padding: 12px 15px;
            }
           
            .breadcrumb {
                font-size: 0.85rem;
                margin-bottom: 10px;
            }
           
            .app-header h1 {
                font-size: 1.5rem;
                margin-bottom: 6px;
            }
           
            .description {
                font-size: 0.9rem;
            }
           
            .selector-container {
                grid-template-columns: 1fr;
                gap: 10px;
                margin-bottom: 20px;
                padding: 15px;
            }
           
            .bible-content {
                padding: 15px;
                min-height: 450px;
            }
           
            .chapter-title {
                font-size: 1.3rem;
                margin-bottom: 15px;
            }
           
            .content-display {
                height: 500px;
            }
           
            .navigation {
                flex-direction: column;
                gap: 10px;
            }
           
            .nav-btn, .wiki-link {
                width: 100%;
                justify-content: center;
            }
        }
 
        @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 {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #7f8c8d;
            text-align: center;
        }
 
        .placeholder i {
            font-size: 3rem;
            margin-bottom: 15px;
            color: var(--border-color);
        }
 
        /* استایل برای راست‌چین کامل */
        option {
            direction: rtl;
            text-align: right;
         }
         }
     </style>
     </style>
خط ۳۸۴: خط ۵۶:
<body>
<body>
     <div class="container">
     <div class="container">
         <div class="app-header">
         <h1>تست باز شدن لینک‌ها در پنجره جدید</h1>
            <nav class="breadcrumb">
        <p>صفحه زیر حاوی چند لینک است. روی آنها کلیک کنید تا ببینید در پنجره جدید باز می‌شوند یا نه.</p>
                <a href="https://www.pediabible.com" class="breadcrumb-home">خانه</a>
       
                <span class="breadcrumb-separator">/</span>
        <button onclick="loadIframe()">بارگذاری iframe تست</button>
                <span class="breadcrumb-current">کتاب مقدس</span>
       
            </nav>
        <div id="iframe-container"></div>
            <h1>کتاب مقدس</h1>
            <p class="description">مطالعه کتاب مقدس با ترجمه‌های مختلف</p>
        </div>
          
          
         <div id="content-wrapper">
         <div id="result" class="result">
             <!-- محتوا توسط JavaScript پر می‌شود -->
             نتیجه تست اینجا نمایش داده می‌شود...
         </div>
         </div>
     </div>
     </div>


     <script>
     <script>
        // 🔒 سیستم حفاظتی - بررسی دامنه مجاز
         function loadIframe() {
        const ALLOWED_DOMAINS = [
             const iframeContainer = document.getElementById('iframe-container');
            'pediabible.com',
             const resultDiv = document.getElementById('result');
            'www.pediabible.com',
            'localhost',
            '127.0.0.1'
        ];
 
        // تابع بررسی مجاز بودن دامنه
         function isDomainAllowed() {
             const currentDomain = window.location.hostname;
             console.log('🔍 بررسی دامنه:', currentDomain);
              
              
             // اگر روی فایل محلی هستیم، اجازه بده
             // محتوای HTML ساده با چند لینک برای تست
             if (!currentDomain || currentDomain === '' || currentDomain === 'null') {
             const testContent = `
                 console.log('✅ فایل محلی - مجاز');
                <!DOCTYPE html>
                 return true;
                <html>
            }
                 <head>
           
                    <title>صفحه تست</title>
            const isAllowed = ALLOWED_DOMAINS.some(domain => {
                    <style>
                const match = currentDomain === domain || currentDomain.endsWith('.' + domain);
                        body { font-family: Arial; padding: 20px; }
                if (match) {
                        a { display: block; margin: 10px 0; padding: 10px; background: #eee; }
                     console.log(`✅ دامنه ${currentDomain} مجاز است`);
                    </style>
                 }
                 </head>
                 return match;
                <body>
             });
                    <h3>صفحه تست لینک‌ها</h3>
                    <a href="https://www.google.com">لینک ۱: گوگل</a>
                    <a href="https://www.wikipedia.org">لینک ۲: ویکی‌پدیا</a>
                    <a href="https://www.github.com">لینک ۳: گیت‌هاب</a>
                     <p>روی لینک‌های بالا کلیک کنید</p>
                 </body>
                 </html>
             `;
              
              
             if (!isAllowed) {
             // ایجاد iframe
                console.log(`❌ دامنه ${currentDomain} غیرمجاز است`);
            const iframe = document.createElement('iframe');
            }
            iframe.id = 'test-iframe';
            iframeContainer.innerHTML = '';
            iframeContainer.appendChild(iframe);
              
              
             return isAllowed;
             // نوشتن محتوا در iframe
        }
             const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
 
            iframeDoc.open();
        // تابع نمایش پیام دسترسی غیرمجاز
             iframeDoc.write(testContent);
        function showAccessDenied() {
             iframeDoc.close();
             const wrapper = document.getElementById('content-wrapper');
             wrapper.innerHTML = `
                <div class="access-denied">
                    <h3><i class="fas fa-ban"></i> دسترسی محدود شده</h3>
                    <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>
                </div>
            `;
        }
 
        // تابع اصلی بارگذاری برنامه
        function loadApplication() {
             console.log('🚀 شروع بارگذاری با بررسی امنیتی...');
              
              
             if (!isDomainAllowed()) {
             resultDiv.innerHTML = '<div class="success">iframe بارگذاری شد. حالا روی لینک‌ها کلیک کنید.</div>';
                console.log('❌ دسترسی غیرمجاز - نمایش پیام خطا');
                showAccessDenied();
                return;
            }
 
            console.log('✅ دامنه مجاز - بارگذاری برنامه اصلی');
            // اگر دامنه مجاز باشد، برنامه اصلی بارگذاری می‌شود
            initializeBibleApp();
        }
 
        // داده‌های کامل کتاب‌های مقدس
        const bibleBooks = {
            old: [
                { name: "پیدایش", chapters: 50, displayName: "پیدایش" },
                { name: "خروج", chapters: 40, displayName: "خروج" },
                { name: "لاویان", chapters: 27, displayName: "لاویان" },
                { name: "اعداد", chapters: 36, displayName: "اعداد" },
                { name: "تثنیه", chapters: 34, displayName: "تثنیه" },
                { name: "یوشع", chapters: 24, displayName: "یوشع" },
                { name: "داوران", chapters: 21, displayName: "داوران" },
                { name: "روت", chapters: 4, displayName: "روت" },
                { name: "اول سموئیل", chapters: 31, displayName: "اول سموئیل" },
                { name: "دوم سموئیل", chapters: 24, displayName: "دوم سموئیل" },
                { name: "اول پادشاهان", chapters: 22, displayName: "اول پادشاهان" },
                { name: "دوم پادشاهان", chapters: 25, displayName: "دوم پادشاهان" },
                { name: "اول تواریخ", chapters: 29, displayName: "اول تواریخ" },
                { name: "دوم تواریخ", chapters: 36, displayName: "دوم تواریخ" },
                { name: "عزرا", chapters: 10, displayName: "عزرا" },
                { name: "نحمیا", chapters: 13, displayName: "نحمیا" },
                { name: "استر", chapters: 10, displayName: "استر" },
                { name: "ایوب", chapters: 42, displayName: "ایوب" },
                { name: "مزامیر", chapters: 150, displayName: "مزامیر" },
                { name: "امثال سلیمان", chapters: 31, displayName: "امثال سلیمان" },
                { name: "جامعه", chapters: 12, displayName: "جامعه" },
                { name: "غزل غزلهای سلیمان", chapters: 8, displayName: "غزل غزلهای سلیمان" },
                { name: "اشعیا", chapters: 66, displayName: "اشعیا" },
                { name: "ارمیا", chapters: 52, displayName: "ارمیا" },
                { name: "مراثی ارمیا", chapters: 5, displayName: "مراثی ارمیا" },
                { name: "حزقیال", chapters: 48, displayName: "حزقیال" },
                { name: "دانیال", chapters: 12, displayName: "دانیال" },
                { name: "هوشع", chapters: 14, displayName: "هوشع" },
                { name: "یوئیل", chapters: 3, displayName: "یوئیل" },
                { name: "عاموس", chapters: 9, displayName: "عاموس" },
                { name: "عوبدیا", chapters: 1, displayName: "عوبدیا" },
                { name: "یونس", chapters: 4, displayName: "یونس" },
                { name: "میکاه", chapters: 7, displayName: "میکاه" },
                { name: "ناحوم", chapters: 3, displayName: "ناحوم" },
                { name: "حبقوق", chapters: 3, displayName: "حبقوق" },
                { name: "صفنیا", chapters: 3, displayName: "صفنیا" },
                { name: "حجی", chapters: 2, displayName: "حجی" },
                { name: "زکریا", chapters: 14, displayName: "زکریا" },
                { name: "ملاکی", chapters: 4, displayName: "ملاکی" }
            ],
            new: [
                { name: "متی", chapters: 28, displayName: "انجیل به قلم متی" },
                { name: "مرقس", chapters: 16, displayName: "انجیل به قلم مرقس" },
                { name: "لوقا", chapters: 24, displayName: "انجیل به قلم لوقا" },
                { name: "یوحنا", chapters: 21, displayName: "انجیل به قلم یوحنا" },
                { name: "اعمال ", chapters: 28, displayName: "اعمال " },
                { name: "رومیان", chapters: 16, displayName: "رساله به رومیان" },
                { name: "اول قرنتیان", chapters: 16, displayName: "رساله اول به قرنتیان" },
                { name: "دوم قرنتیان", chapters: 13, displayName: "رساله دوم به قرنتیان" },
                { name: "غلاطیان", chapters: 6, displayName: "رساله به غلاطیان" },
                { name: "افسسیان", chapters: 6, displayName: "رساله به افسسیان" },
                { name: "فیلیپیان", chapters: 4, displayName: "رساله به فیلیپیان" },
                { name: "کولسیان", chapters: 4, displayName: "رساله به کولسیان" },
                { name: "اول تسالونیکیان", chapters: 5, displayName: "رساله اول به تسالونیکیان" },
                { name: "دوم تسالونیکیان", chapters: 3, displayName: "رساله دوم به تسالونیکیان" },
                { name: "اول تیموتائوس", chapters: 6, displayName: "رساله اول به تیموتائوس" },
                { name: "دوم تیموتائوس", chapters: 4, displayName: "رساله دوم به تیموتائوس" },
                { name: "تیتوس", chapters: 3, displayName: "رساله به تیتوس" },
                { name: "فیلیمون", chapters: 1, displayName: "رساله به فیلیمون" },
                { name: "عبرانیان", chapters: 13, displayName: "رساله به عبرانیان" },
                { name: "یعقوب", chapters: 5, displayName: "رساله یعقوب" },
                { name: "اول پطرس", chapters: 5, displayName: "رساله اول پطرس" },
                { name: "دوم پطرس", chapters: 3, displayName: "رساله دوم پطرس" },
                { name: "اول یوحنا", chapters: 5, displayName: "رساله اول یوحنا" },
                { name: "دوم یوحنا", chapters: 1, displayName: "رساله دوم یوحنا" },
                { name: "سوم یوحنا", chapters: 1, displayName: "رساله سوم یوحنا" },
                { name: "یهودا", chapters: 1, displayName: "رساله یهودا" },
                { name: "کتاب مکاشفه", chapters: 22, displayName: "کتاب مکاشفه " }
            ]
        };
 
        // 🔧 برنامه اصلی کتاب مقدس
        function initializeBibleApp() {
            const wrapper = document.getElementById('content-wrapper');
              
              
             // ایجاد ساختار HTML برنامه
             // مدیریت لینک‌های داخل iframe
             wrapper.innerHTML = `
             setTimeout(() => {
                 <div class="selector-container">
                 try {
                     <div class="selector-box">
                     const iframeWindow = iframe.contentWindow;
                        <h3 class="selector-title">ترجمه</h3>
                    const iframeDoc = iframe.contentDocument;
                        <select id="translation-select">
                            <option value="">انتخاب ترجمه</option>
                            <option value="old">ترجمه قدیم</option>
                            <option value="hejre_nou">هزاره نو</option>
                            <option value="mozde">مژده</option>
                            <option value="daneshname">دانشنامه</option>
                        </select>
                    </div>
                      
                      
                     <div class="selector-box">
                     // روش ۱: تغییر target همه لینک‌ها به _blank
                        <h3 class="selector-title">عهد</h3>
                    const links = iframeDoc.querySelectorAll('a');
                        <select id="testament-select" disabled>
                    links.forEach(link => {
                            <option value="">انتخاب عهد</option>
                         link.target = '_blank';
                            <option value="old">عهد قدیم</option>
                     });
                            <option value="new">عهد جدید</option>
                         </select>
                     </div>
                      
                      
                     <div class="selector-box">
                     // روش ۲: اضافه کردن event listener برای اطمینان بیشتر
                        <h3 class="selector-title">کتاب</h3>
                     iframeDoc.addEventListener('click', function(e) {
                        <select id="book-select" disabled>
                         if (e.target.tagName === 'A' && e.target.href) {
                            <option value="">انتخاب کتاب</option>
                            e.preventDefault();
                        </select>
                            window.open(e.target.href, '_blank');
                    </div>
                         }
                   
                    <div class="selector-box">
                        <h3 class="selector-title">فصل</h3>
                        <select id="chapter-select" disabled>
                            <option value="">انتخاب فصل</option>
                        </select>
                    </div>
                </div>
               
                <div class="bible-content">
                    <h2 class="chapter-title" id="chapter-title">لطفاً ترجمه، کتاب و فصل مورد نظر را انتخاب کنید</h2>
                   
                    <div id="verses-container">
                        <div class="instructions">
                            <div class="placeholder">
                                <i class="fas fa-book-open"></i>
                                <p>برای مطالعه کتاب مقدس، لطفاً ابتدا ترجمه، سپس عهد، کتاب و فصل مورد نظر خود را انتخاب کنید.</p>
                            </div>
                        </div>
                    </div>
                   
                    <div class="navigation">
                        <button class="nav-btn" id="prev-chapter" disabled>
                            <i class="fas fa-arrow-right"></i>
                            فصل قبلی
                        </button>
                       
                        <a href="#" class="wiki-link" id="wiki-page-link" target="_blank" style="display: none;">
                            <i class="fas fa-external-link-alt"></i>
                            صفحه کامل
                        </a>
                       
                        <button class="nav-btn" id="next-chapter" disabled>
                            فصل بعدی
                            <i class="fas fa-arrow-left"></i>
                        </button>
                    </div>
                </div>
            `;
 
            // داده‌های ترجمه‌های مختلف
            const translations = {
                'old': {
                    name: 'ترجمه قدیم',
                    baseUrl: 'https://www.pediabible.com/index.php?title=',
                    // برای ترجمه قدیم از الگوی ساده با displayName استفاده می‌کنیم
                     getPageTitle: function(bookDisplayName, chapter) {
                        return `${bookDisplayName} فصل ${chapter}`;
                    }
                },
                'hejre_nou': {
                    name: 'هزاره نو',
                    baseUrl: 'https://www.pediabible.com/index.php?title=',
                    // برای ترجمه‌های جدید از displayName + نام ترجمه استفاده می‌کنیم
                    getPageTitle: function(bookDisplayName, chapter) {
                        return `${bookDisplayName} هزاره نو فصل ${chapter}`;
                    }
                },
                'mozde': {
                    name: 'مژده',
                    baseUrl: 'https://www.pediabible.com/index.php?title=',
                    getPageTitle: function(bookDisplayName, chapter) {
                         return `${bookDisplayName} مژده فصل ${chapter}`;
                    }
                },
                'daneshname': {
                    name: 'دانشنامه',
                    baseUrl: 'https://www.pediabible.com/index.php?title=',
                    getPageTitle: function(bookDisplayName, chapter) {
                        return `${bookDisplayName} دانشنامه فصل ${chapter}`;
                    }
                }
            };
 
            // عناصر DOM
            const translationSelect = document.getElementById('translation-select');
            const testamentSelect = document.getElementById('testament-select');
            const bookSelect = document.getElementById('book-select');
            const chapterSelect = document.getElementById('chapter-select');
            const chapterTitle = document.getElementById('chapter-title');
            const versesContainer = document.getElementById('verses-container');
            const prevChapterBtn = document.getElementById('prev-chapter');
            const nextChapterBtn = document.getElementById('next-chapter');
            const wikiPageLink = document.getElementById('wiki-page-link');
 
            // متغیرهای وضعیت فعلی
            let currentTranslation = '';
            let currentTestament = '';
            let currentBook = '';
            let currentChapter = 1;
 
            // رویداد تغییر ترجمه
            translationSelect.addEventListener('change', function() {
                currentTranslation = this.value;
               
                if (currentTranslation) {
                    testamentSelect.disabled = false;
                    testamentSelect.value = '';
                    bookSelect.disabled = true;
                    bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                    chapterSelect.disabled = true;
                    chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                    resetContent();
                } else {
                    resetAll();
                }
            });
 
            // رویداد تغییر عهد
            testamentSelect.addEventListener('change', function() {
                currentTestament = this.value;
               
                if (currentTestament) {
                    bookSelect.disabled = false;
                    bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                   
                    bibleBooks[currentTestament].forEach((book, index) => {
                        const option = document.createElement('option');
                         option.value = index;
                        option.textContent = book.name;
                        bookSelect.appendChild(option);
                     });
                     });
                      
                      
                     chapterSelect.disabled = true;
                     resultDiv.innerHTML += `<div class="success">${links.length} لینک مدیریت شدند. حالا تست کنید!</div>`;
                    chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                    resetContent();
                } else {
                    bookSelect.disabled = true;
                    bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                    chapterSelect.disabled = true;
                    chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                    resetContent();
                }
            });
 
            // رویداد تغییر کتاب
            bookSelect.addEventListener('change', function() {
                currentBook = this.value;
               
                if (currentBook !== '') {
                    chapterSelect.disabled = false;
                    chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                      
                      
                    const bookIndex = parseInt(currentBook);
                } catch (error) {
                    const chaptersCount = bibleBooks[currentTestament][bookIndex].chapters;
                     resultDiv.innerHTML = `<div class="error">خطا در مدیریت لینک‌ها: ${error.message}</div>`;
                   
                    for (let i = 1; i <= chaptersCount; i++) {
                        const option = document.createElement('option');
                        option.value = i;
                        option.textContent = `فصل ${i}`;
                        chapterSelect.appendChild(option);
                    }
                   
                    prevChapterBtn.disabled = true;
                    nextChapterBtn.disabled = true;
                    wikiPageLink.style.display = 'none';
                } else {
                     chapterSelect.disabled = true;
                    chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                    resetContent();
                 }
                 }
             });
             }, 1000);
 
        }
            // رویداد تغییر فصل
       
            chapterSelect.addEventListener('change', function() {
        // تست اضافی: ایجاد یک iframe با sandbox
                currentChapter = parseInt(this.value);
        function loadSandboxIframe() {
               
            const iframeContainer = document.getElementById('iframe-container');
                if (currentChapter) {
             const resultDiv = document.getElementById('result');
                    displayChapterWithIframe();
              
                } else {
             iframeContainer.innerHTML = `
                    resetContent();
                 <iframe
                }
                     src="https://en.wikipedia.org/wiki/Main_Page"
            });
                     sandbox="allow-scripts allow-same-origin allow-popups"
 
                    width="100%"  
            // نمایش فصل با iframe - فقط محتوای اصلی
                    height="300">
            function displayChapterWithIframe() {
                </iframe>
                const bookIndex = parseInt(currentBook);
            `;
                const bookData = bibleBooks[currentTestament][bookIndex];
              
                const bookName = bookData.name;
             resultDiv.innerHTML = '<div class="success">iframe با sandbox بارگذاری شد. لینک‌ها باید در پنجره جدید باز شوند.</div>';
                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 = `
                    <iframe  
                        id="content-iframe"
                        src="${contentUrl}"
                        class="content-display"
                        frameborder="0"
                        loading="lazy"
                        allowfullscreen>
                    </iframe>
                `;
               
                // لینک صفحه کامل برای باز کردن در تب جدید
                wikiPageLink.href = `${translations[currentTranslation].baseUrl}${encodeURIComponent(pageTitle)}`;
                wikiPageLink.style.display = 'flex';
                updateNavigationButtons();
             }
 
            function updateNavigationButtons() {
                const bookIndex = parseInt(currentBook);
                const chaptersCount = bibleBooks[currentTestament][bookIndex].chapters;
               
                prevChapterBtn.disabled = currentChapter <= 1;
                nextChapterBtn.disabled = currentChapter >= chaptersCount;
            }
 
            prevChapterBtn.addEventListener('click', function() {
                if (currentChapter > 1) {
                    currentChapter--;
                    chapterSelect.value = currentChapter;
                    displayChapterWithIframe();
                }
             });
 
             nextChapterBtn.addEventListener('click', function() {
                const bookIndex = parseInt(currentBook);
                 const chaptersCount = bibleBooks[currentTestament][bookIndex].chapters;
               
                if (currentChapter < chaptersCount) {
                     currentChapter++;
                    chapterSelect.value = currentChapter;
                    displayChapterWithIframe();
                }
            });
 
            function resetContent() {
                chapterTitle.textContent = 'لطفاً ترجمه، کتاب و فصل مورد نظر را انتخاب کنید';
                versesContainer.innerHTML = `
                     <div class="instructions">
                        <div class="placeholder">
                            <i class="fas fa-book-open"></i>
                            <p>برای مطالعه کتاب مقدس، لطفاً ابتدا ترجمه، سپس عهد، کتاب و فصل مورد نظر خود را انتخاب کنید.</p>
                        </div>
                    </div>
                `;
                prevChapterBtn.disabled = true;
                nextChapterBtn.disabled = true;
                wikiPageLink.style.display = 'none';
             }
 
             function resetAll() {
                testamentSelect.disabled = true;
                testamentSelect.innerHTML = '<option value="">انتخاب عهد</option>';
                bookSelect.disabled = true;
                bookSelect.innerHTML = '<option value="">انتخاب کتاب</option>';
                chapterSelect.disabled = true;
                chapterSelect.innerHTML = '<option value="">انتخاب فصل</option>';
                resetContent();
            }
 
            console.log('✅ برنامه کتاب مقدس روی دامنه مجاز بارگذاری شد');
         }
         }
        // 🔒 شروع برنامه با بررسی امنیتی
        document.addEventListener('DOMContentLoaded', function() {
            console.log('🚀 شروع بارگذاری با بررسی امنیتی...');
            loadApplication();
        });
        // 🔒 جلوگیری از دسترسی به توابع از کنسول
        Object.defineProperty(window, 'translations', {
            value: null,
            writable: false,
            configurable: false
        });
     </script>
     </script>
   
    <div class="container">
        <h2>تست دوم: iframe با محتوای واقعی</h2>
        <button onclick="loadSandboxIframe()">بارگذاری ویکی‌پدیا (sandbox)</button>
        <p>این iframe از یک سایت واقعی بارگذاری می‌شود.</p>
    </div>
</body>
</body>
</html>
</html>

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

<!DOCTYPE html> تست لینک‌های iframe

تست باز شدن لینک‌ها در پنجره جدید

صفحه زیر حاوی چند لینک است. روی آنها کلیک کنید تا ببینید در پنجره جدید باز می‌شوند یا نه.

نتیجه تست اینجا نمایش داده می‌شود...