لوحة دمج وتشفير الملفات مع الترويسات - النسخة المصححة (iframe)
🎨 لوحة دمج وتشفير الملفات مع الترويسات
📋 معاينة الترويسة العلوية
⚙️ إعدادات اللوجو والترويسة العلوية
📄 معاينة محتوى المستخدم
هنا يظهر محتوى المستخدم (ملف HTML الخارجي)قم برفع ملف HTML لرؤية المعاينة
📋 معاينة الترويسة السفلية
⚙️ إعدادات الترويسة السفلية
🌈 خلفية الترويسة السفلية
🔍 شفافية الترويسة السفلية:
✏️ لون خط الترويسة السفلية
📝 نص الترويسة السفلية
🔐 إعدادات الملف والتشفير
🚀 توليد الملف النهائي والكود
📋 الكود المولد:
💾 تحميل الملف النهائي
📋 نسخ الكود
${headerText}
`;
const footerHtml = `
${footerText}
`;
const userContent = userHtmlContent || generateDefaultContent();
return `
ملف مدمج مع ترويسات ${headerHtml}
${userContent}
${footerHtml}
`;
} catch (error) { console.error('خطأ في بناء الملف النهائي:', error); return '
'; }
}
function getLogoStyleString() {
try {
const size = parseInt(safeGetValue('logoSize', '80')) || 80; const shape = safeGetValue('logoShape', 'circle'); const bgColor = safeGetValue('logoBg', '#ffffff'); const alpha = parseFloat(safeGetValue('logoAlpha', '1')) || 1;
let width = size, height = size, radius = '50%';
switch (shape) { case 'square': radius = '0'; break; case 'rect': radius = '0'; width = Math.round(size * 1.5); break; case 'oval': radius = '50%'; width = Math.round(size * 1.3); height = Math.round(size * 0.8); break; case 'rounded': radius = '18px'; break; }
return `width:${width}px;height:${height}px;background:${hexToRgba(bgColor, alpha)};border-radius:${radius};display:flex;align-items:center;justify-content:center;overflow:hidden;margin-left:16px;border:3px solid rgba(25,118,210,0.2);box-shadow:0 4px 12px rgba(0,0,0,0.1);`;
} catch (error) { return 'width:80px;height:80px;background:rgba(255,255,255,1);border-radius:50%;display:flex;align-items:center;justify-content:center;overflow:hidden;margin-left:16px;'; }
}
function generateDefaultContent() { return `
مرحباً بك في الملف المدمج هذا محتوى افتراضي يظهر عندما لا يتم رفع ملف HTML خارجي. يمكنك استبدال هذا المحتوى بملفك الخاص.
كيفية الاستخدام: قم برفع ملف HTML في لوحة التحكم خصص الترويسة العلوية والسفلية اختر إعدادات التشفير حسب الحاجة احصل على الملف النهائي المدمج `; }
function encryptHtml(html, password, usage) {
try {
const restoreLink = safeGetValue('restoreLink', '');
const encrypted = CryptoJS.AES.encrypt(html, password).toString();
const jsPassword = JSON.stringify(password);
const jsEncryptedData = JSON.stringify(encrypted);
const jsRestoreLink = JSON.stringify(restoreLink || 'سيتم إرسال الرابط عبر البريد الإلكتروني');
const generationTimestamp = Date.now();
return `
ملف مشفر - يتطلب كلمة سر 🔐
الملف محمي بكلمة سر يرجى إدخال كود فك التشفير للوصول إلى المحتوى
عدد الاستخدامات المتبقية: ${usage}
🔓 فتح الملف
`;
} catch (error) { console.error('خطأ في التشفير:', error); console.error(error.message || '❌ حدث خطأ في التشفير'); return html; }
}
function showGeneratedCode(htmlContent) {
try {
const gcs = document.getElementById('generatedCodeSection');
if(gcs) gcs.style.display = 'block';
const gc = document.getElementById('generatedCode');
if(gc) gc.value = htmlContent;
setupDownloadAndCopy(htmlContent);
} catch (error) { console.warn('خطأ في عرض الكود المولد:', error); }
}
function setupDownloadAndCopy(htmlContent) {
try {
const downloadBtn = document.getElementById('downloadBtn');
const copyCodeBtn = document.getElementById('copyCodeBtn');
const enableEncryption = document.getElementById('enableEncryption');
if (downloadBtn) {
downloadBtn.onclick = () => {
try {
const blob = new Blob([htmlContent], {type: "text/html;charset=utf-8"});
const url = URL.createObjectURL(blob); const a = document.createElement('a');
a.href = url; a.download = (enableEncryption && enableEncryption.checked) ? 'merged_encrypted.html' : 'merged_file.html';
document.body.appendChild(a); a.click();
setTimeout(() => { document.body.removeChild(a); URL.revokeObjectURL(url); }, 500);
downloadBtn.textContent = '✅ تم التحميل'; setTimeout(() => { downloadBtn.textContent = '💾 تحميل الملف النهائي'; }, 2000);
} catch (error) { console.error('❌ حدث خطأ في تحميل الملف:', error); }
};
}
if (copyCodeBtn) {
copyCodeBtn.onclick = () => {
try {
const GCI = document.getElementById('generatedCode');
if(GCI) { GCI.select(); document.execCommand('copy'); }
copyCodeBtn.textContent = '✅ تم النسخ'; setTimeout(() => { copyCodeBtn.textContent = '📋 نسخ الكود'; }, 2000);
} catch (error) { console.error('❌ حدث خطأ في نسخ الكود:', error); }
};
}
} catch (error) { console.warn('خطأ في إعداد التحميل والنسخ:', error); }
}
function initializePage() {
try {
safeSetText('logoSizeValue', '80px'); safeSetText('logoAlphaValue', '100%');
safeSetText('headerAlphaValue', '100%'); safeSetText('footerAlphaValue', '100%');
const encStatus = document.getElementById('encryptionStatus');
if (encStatus) encStatus.className = 'status-indicator status-pending';
updateLogoStyle(); updateHeaderStyle(); updateFooterStyle(); initializeEvents();
} catch (error) { console.warn('خطأ في تهيئة الصفحة:', error); }
}
if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initializePage); }
else { initializePage(); }