Skip to content

Latest commit

 

History

History
6574 lines (5644 loc) · 248 KB

File metadata and controls

6574 lines (5644 loc) · 248 KB
<title>شات حور - الذكاء المتحدث</title>
<!-- 🔥 1. رابط Font Awesome للأيقونات -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

<!-- 🔥 2. رابط ملف CSS الخاص بالنظام -->
<link rel="stylesheet" href="competition-style.css">

<!-- 🔥 3. رابط مكتبة الأسئلة -->
<script src="questions-library.js"></script>
<style> /* أضف في قسم الـ styles */ /* ======= نظام WebSocket الحقيقي ======= */ .ws-status-bar { position: fixed; top: 10px; left: 10px; right: 10px; background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 15px; border-radius: 15px; display: flex; justify-content: space-between; align-items: center; z-index: 9999; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 5px 20px rgba(0,0,0,0.3); } .ws-status-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 10px; } .ws-status-dot.connected { background: #4CAF50; animation: pulse 2s infinite; } .ws-status-dot.connecting { background: #FF9800; animation: pulse 1s infinite; } .ws-status-dot.disconnected { background: #F44336; } .server-ip-display { background: rgba(255,255,255,0.1); padding: 5px 10px; border-radius: 10px; font-family: monospace; font-size: 0.9em; cursor: pointer; } .server-ip-display:hover { background: rgba(255,255,255,0.2); } /* نافذة إعدادات الخادم */ .ws-config-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); display: flex; justify-content: center; align-items: center; z-index: 10005; backdrop-filter: blur(20px); } .ws-config-container { background: rgba(255,255,255,0.1); padding: 30px; border-radius: 20px; width: 90%; max-width: 500px; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); } .ws-config-title { color: white; text-align: center; margin-bottom: 30px; font-size: 1.5em; display: flex; align-items: center; justify-content: center; gap: 15px; } .ws-input-group { margin-bottom: 20px; } .ws-input-label { color: #aaa; margin-bottom: 8px; display: block; } .ws-input { width: 100%; padding: 15px; background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.1); border-radius: 10px; color: white; font-size: 1em; outline: none; transition: all 0.3s; } .ws-input:focus { border-color: #00bcd4; box-shadow: 0 0 20px rgba(0, 188, 212, 0.3); } .ws-auto-detect { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 10px; margin-top: 20px; } /* قائمة المستخدمين الحية */ .live-users-panel { position: fixed; top: 60px; right: 20px; width: 300px; max-height: 80vh; background: rgba(0, 0, 0, 0.9); border-radius: 15px; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); z-index: 9998; overflow: hidden; display: none; } .live-users-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 15px; color: white; display: flex; justify-content: space-between; align-items: center; } .live-users-list { max-height: 400px; overflow-y: auto; padding: 15px; } .live-user-item { display: flex; align-items: center; padding: 10px; margin-bottom: 10px; background: rgba(255,255,255,0.05); border-radius: 10px; transition: all 0.3s; } .live-user-item:hover { background: rgba(255,255,255,0.1); transform: translateX(-5px); } .live-user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; margin-left: 10px; color: white; } .live-user-info { flex: 1; } .live-user-name { color: white; font-weight: bold; } .live-user-role { font-size: 0.8em; color: #aaa; } .live-user-status { width: 8px; height: 8px; border-radius: 50%; background: #4CAF50; box-shadow: 0 0 10px #4CAF50; } /* رسائل النظام */ .system-message { background: rgba(0, 188, 212, 0.1); border: 1px solid rgba(0, 188, 212, 0.3); color: #00bcd4; padding: 10px 15px; border-radius: 10px; margin: 10px 20px; text-align: center; font-size: 0.9em; } /* رسائل الوقت الحقيقي */ .realtime-message { animation: messagePop 0.3s ease; } @keyframes messagePop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } } /* مؤشر الكتابة */ .typing-indicator { display: flex; align-items: center; padding: 10px 15px; color: #aaa; font-size: 0.9em; gap: 10px; } .typing-dots { display: flex; gap: 4px; } .typing-dot { width: 8px; height: 8px; background: #aaa; border-radius: 50%; animation: typing 1.4s infinite; } .typing-dot:nth-child(2) { animation-delay: 0.2s; } .typing-dot:nth-child(3) { animation-delay: 0.4s; } @keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } } .chat-controls { display: flex; gap: 10px; align-items: center; } .control-btn { background: linear-gradient(to right, var(--primary-color), var(--dark-color)); color: white; border: none; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 0.8em; transition: all 0.3s; display: flex; align-items: center; gap: 5px; } .control-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); } .control-btn:nth-child(2) { background: linear-gradient(to right, var(--secondary-color), var(--accent-color)); } .control-btn:nth-child(3) { background: linear-gradient(to right, #ff4081, #f50057); } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Tahoma', Geneva, Verdana, sans-serif; } :root { --primary-color: #1a5e25; --primary-dark: #0d4d1a; --secondary-color: #d4af37; --bg-dark: #0c1a0e; --bg-light: #1a2c1e; --text-primary: #ffffff; --text-secondary: #afffd6a7; --border-color: #2e7d32; --message-bg: #1bfffe20; --my-message-bg: #2e7d32; --paradise-bg: linear-gradi --primary-color: #77fffe22; --secondary-color: #70a25bcf; --accent-color: #ba7775d3; --light-color: #f8f0ff; --dark-color: #4b0082; --user-msg-color: #171; --bot-msg-color: #2ff745; --danger-color: #fff860; --warning-color: #ff9800; primary-color: #2e7d32; --primary-dark: #1b5e20; --secondary-color: #c49000; --bg-dark: #f1f8e9; --bg-light: #fff55fff; --text-primary: #1b5e20; --text-secondary: #388e3c; --border-color: #c8e6c9; --message-bg: #e8f5e9; --my-message-bg: #c66666c9; --paradise-bg: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); --shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } body { background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 10%); color: #336663; min-height: 10vh; overflow-x: hidden; } .container { max-width: 100000px; margin: 1 auto; height: 190vh; display: flex; flex-direction: column; justify-content: space-between; background-color: white; box-shadow: var(--shadow); position: relative; } /* Header */ .header { background: none; border: 3px solid var(--border-col); color: var(--text-primary); padding: 5px border-radius: 5px; cursor: pointer; display: flex; justify-content:space-between; align-items: center; box-shadow: gap: 5px; transition: all 0.s padding: 5px 5px; background: linear-gradient(to right, var(--dark-color), var(--primary-color)); color: white; text-align: center; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--accent-color); } .bot-info { display: flex; align-items: center; gap: 3px; } المسابقات الإسلامية chat-controls نسخ طباعة .bot-avatar { width: 60px; height: 60px; border-radius: 50%; border: 500px solid white; overflow: hidden; background: linear-gradient(45deg, var(--accent-color), var(--secondary-color)); display: flex; align-items: center; justify-content: center; color: white; font-size: 15px; } .bot-name { font-size: 1.1em; font-weight: bold; } .bot-subtitle { font-size: 0.9em; opacity: 0.9; } .contact-info { font-size: 0.8em; direction: ltr; background: rgba(255, 255, 255, 0.2); padding: 5px 10px; border-radius: 20px; } /* Chat Area */ .chat-container { flex: 1; display: flex; flex-direction: column; position: relative; flex: 1; display: flex; overflow: hidden; } .chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; background: linear-gradient(to bottom, #f9f9f9, #f0f0f0); background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); } .message { padding: 12px 18px; border-radius: 20px; max-width: 75%; word-wrap: break-word; animation: fadeIn 0.3s ease; line-height: 1.5; position: relative; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .user-message { align-self: flex-end; background: linear-gradient(to left, var(--user-msg-color), #0056b3); color: white; border-bottom-right-radius: 5px; } .bot-message { align-self: flex-start; background: linear-gradient(to right, var(--bot-msg-color), #1e7e34); color: white; border-bottom-left-radius: 5px; } .message-time { font-size: 0.7em; opacity: 0.8; margin-top: 5px; text-align: left; } /* Message Actions - جديد */ .message-actions { display: flex; gap: 8px; margin-top: 8px; opacity: 5; transition: opacity 0.3s; } messages-container { flex: 1; padding: 20px; overflow-y: auto; background: var(--bg-dark); display: flex; flex-direction: column; gap: 15px; } .message { max-width: 70%; padding: 12px 16px; border-radius: 15px; position: relative; word-wrap: break-word; animation: messageAppear 0.3s ease-out; } @keyframes messageAppear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .message.received { background: var(--message-bg); align-self: flex-start; border-bottom-right-radius: 5px; } .message.sent { background: var(--my-message-bg); align-self: flex-end; border-bottom-left-radius: 5px; } .message-system { align-self: center; background: var(--secondary-color); color: var(--primary-dark); padding: 8px 15px; border-radius: 10px; font-size: 0.9rem; max-width: 80%; text-align: center; } .message-sender { font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; color: var(--text-secondary); } .message-content { line-height: 1.5; margin-bottom: 8px; } .message-time { font-size: 0.8rem; opacity: 0.7; text-align: left; } .message.sent .message-time { text-align: right; } .input-area { padding: 15px 20px; background: var(--bg-light); border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 10px; } .message-input { flex: 1; padding: 12px 20px; background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 25px; color: var(--text-primary); outline: none; font-size: 14px; min-height: 50px; max-height: 150px; resize: none; font-family: inherit; } .message-input:focus { border-color: var(--secondary-color); } .message:hover .message-actions { opacity: 1; } .action-btn { background: rgba(255, 255, 255, 0.2); border: none; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: white; font-size: 0.9em; transition: all 0.3s; } .action-btn:hover { background: rgba(255, 255, 255, 0.4); transform: scale(1.1); } /* Input Area */ .input-area { padding: 15px; background: white; border-top: 1px solid #ddd; display: flex; flex-direction: column; gap: 10px; } .input-row { display: flex; gap: 10px; } input[type="text"] { flex: 1; padding: 12px 15px; border-radius: 25px; border: 2px solid #ddd; font-size: 1em; transition: all 0.3s; } input[type="text"]:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1); } .voice-input { display: flex; align-items: center; justify-content: center; width: 50px; background: linear-gradient(to bottom, var(--warning-color), #e68900); color: white; border-radius: 50%; cursor: pointer; transition: all 0.3s; } .voice-input:hover { background: linear-gradient(to bottom, #e68900, #cc7a00); transform: scale(1.05); } .voice-input.recording { animation: pulse 1.5s infinite; background: linear-gradient(to bottom, var(--danger-color), #cc2e5d); } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 56, 96, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 56, 96, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 56, 96, 0); } } /* Quick Actions - معدلة */ .quick-actions-container { transition: all 0.3s ease; overflow: hidden; } .quick-actions-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; cursor: pointer; color: var(--dark-color); font-weight: bold; font-size: 0.9em; } .quick-actions-header i { transition: transform 0.3s ease; } .quick-actions-header.collapsed i { transform: rotate(-90deg); } .quick-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; max-height: 300px; overflow-y: auto; transition: max-height 0.3s ease, padding 0.3s ease; } .quick-actions.collapsed { max-height: 0; padding: 0; overflow: hidden; } .quick-btn { padding: 8px 15px; border-radius: 20px; border: none; background: linear-gradient(to right, var(--secondary-color), var(--accent-color)); color: white; cursor: pointer; font-size: 0.85em; transition: all 0.3s; white-space: nowrap; flex-grow: 1; min-width: 120px; max-width: 180px; } .quick-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 90px rgba(0,0,0,0.15); } .quick-btn:nth-child(2n) { background: linear-gradient(to right, var(--primary-color), var(--dark-color)); } .quick-btn:nth-child(3n) { background: linear-gradient(to right, var(--warning-color), #e68900); } .quick-btn:nth-child(4n) { background: linear-gradient(to right, #ff4081, #f50057); } .quick-btn:nth-child(5n) { background: linear-gradient(to right, #00bcd4, #0097a7); } /* Send Button */ .send-btn { padding: 10px 20px; border-radius: 20px; border: none; background: linear-gradient(to right, var(--primary-color), var(--dark-color)); color: white; cursor: pointer; font-weight: bold; font-size: 0.80em; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; } .send-btn:hover { background: linear-gradient(to right, var(--dark-color), #3a0066); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3); } /* Voice Message Player */ .voice-message { background: linear-gradient(to right, #ff9800, #ff5722); color: white; padding: 10px 15px; border-radius: 20px; display: flex; align-items: center; gap: 10px; max-width: 300px; margin-top: 5px; } .voice-message audio { flex: 1; height: 30px; } /* Side Panel */ .side-panel { width: 250px; background: linear-gradient(to bottom, #f8f0ff, #e8e0f5); border-left: 1px solid #ddd; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; } ..side-title { font-size: 1em; /* تم تصحيح 1.em إلى 1em */ font-weight: bold; color: var(--dark-color); padding-bottom: 10px; border-bottom: 2px solid var(--accent-color); text-align: center; display: flex; justify-content: space-between; align-items: center; cursor: pointer; } .side-title i { transition: transform 0.3s ease; font-size: 0.7em; } /* ======= نظام المسابقات والجوائز ======= */ .competition-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); display: flex; justify-content: center; align-items: center; z-index: 10010; backdrop-filter: blur(20px); display: none; } .competition-container { background: linear-gradient(135deg, #1a5e25 0%, #0d4d1a 100%); padding: 30px; border-radius: 25px; width: 90%; max-width: 800px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); border: 3px solid #d4af37; animation: modalPop 0.4s ease; } @keyframes modalPop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } } .competition-header { text-align: center; color: white; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid rgba(212, 175, 55, 0.3); } .competition-header h2 { font-size: 2em; margin-bottom: 10px; color: #d4af37; text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3); } .competition-section { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 20px; margin-bottom: 20px; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1); } .competition-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-top: 15px; } .competition-card { background: rgba(255, 255, 255, 0.15); border-radius: 15px; padding: 20px; text-align: center; transition: all 0.3s; border: 2px solid transparent; cursor: pointer; position: relative; overflow: hidden; } .competition-card:hover { transform: translateY(-5px); border-color: #d4af37; background: rgba(212, 175, 55, 0.1); box-shadow: 0 10px 30px rgba(212, 175, 55, 0.2); } .competition-card.active { border-color: #4CAF50; background: rgba(76, 175, 80, 0.1); } .competition-icon { font-size: 3em; margin-bottom: 15px; color: #d4af37; } .competition-title { color: white; font-weight: bold; font-size: 1.2em; margin-bottom: 10px; } .competition-desc { color: rgba(255, 255, 255, 0.8); font-size: 0.9em; margin-bottom: 15px; min-height: 40px; } .competition-prize { background: rgba(212, 175, 55, 0.2); color: #ffd700; padding: 8px 15px; border-radius: 20px; font-weight: bold; font-size: 0.9em; display: inline-block; border: 1px solid rgba(212, 175, 55, 0.3); } .competition-status { position: absolute; top: 10px; right: 10px; background: #4CAF50; color: white; padding: 3px 10px; border-radius: 10px; font-size: 0.8em; } .competition-status.ended { background: #f44336; } /* زر المسابقات الرئيسي */ .competition-btn { position: fixed; bottom: 120px; right: 20px; background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%); color: white; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 10px 30px rgba(212, 175, 55, 0.4); z-index: 1000; font-size: 1.5em; animation: float 4s ease-in-out infinite; } @keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } } /* لوحة المتصدرين */ .leaderboard-container { max-height: 400px; overflow-y: auto; margin-top: 20px; } .leaderboard-item { display: flex; align-items: center; padding: 15px; margin-bottom: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 12px; transition: all 0.3s; } .leaderboard-item:hover { background: rgba(255, 255, 255, 0.15); transform: translateX(5px); } .leaderboard-rank { background: #d4af37; color: white; width: 35px; height: 35px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-left: 15px; font-size: 1.1em; } .leaderboard-rank.rank-1 { background: #ffd700; } .leaderboard-rank.rank-2 { background: #c0c0c0; } .leaderboard-rank.rank-3 { background: #cd7f32; } .leaderboard-avatar { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; color: white; font-size: 1.3em; margin-left: 15px; } .leaderboard-info { flex: 1; } .leaderboard-name { color: white; font-weight: bold; margin-bottom: 5px; } .leaderboard-points { color: #d4af37; font-weight: bold; font-size: 1.2em; } .leaderboard-level { background: rgba(76, 175, 80, 0.3); color: #4CAF50; padding: 3px 10px; border-radius: 15px; font-size: 0.9em; margin-right: 10px; } /* نظام النقاط والجوائز */ .points-display { position: fixed; top: 80px; left: 20px; background: rgba(0, 0, 0, 0.8); color: white; padding: 12px 20px; border-radius: 15px; backdrop-filter: blur(10px); border: 2px solid #d4af37; z-index: 1000; display: flex; align-items: center; gap: 10px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); animation: slideIn 0.5s ease; } @keyframes slideIn { from { transform: translateX(-100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } } .points-badge { background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; animation: pulse 2s infinite; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } } .points-info { display: flex; flex-direction: column; } .points-label { font-size: 0.8em; color: #aaa; } .points-value { font-size: 1.3em; font-weight: bold; color: #d4af37; } .level-display { margin-right: 15px; background: rgba(76, 175, 80, 0.2); padding: 5px 15px; border-radius: 15px; border: 1px solid rgba(76, 175, 80, 0.3); } /* شارات الإنجاز */ .achievements-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 15px; margin-top: 20px; } .achievement-badge { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); width: 80px; height: 80px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; position: relative; cursor: help; transition: all 0.3s; } .achievement-badge:hover { transform: scale(1.1); box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3); } .achievement-badge.locked { background: #666; filter: grayscale(1); opacity: 0.6; } .achievement-icon { font-size: 2em; margin-bottom: 5px; } .achievement-title { font-size: 0.7em; text-align: center; max-width: 70px; } /* أزرار المشاركة */ .action-buttons { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; } .action-btn-primary { flex: 1; background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%); color: white; border: none; padding: 15px; border-radius: 12px; cursor: pointer; font-weight: bold; font-size: 1em; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 150px; } .action-btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3); } .action-btn-secondary { flex: 1; background: linear-gradient(135deg, #2196F3 0%, #0d47a1 100%); color: white; border: none; padding: 15px; border-radius: 12px; cursor: pointer; font-weight: bold; font-size: 1em; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 150px; } .action-btn-secondary:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(33, 150, 243, 0.3); } /* ====== قسم أنواع الردود والإحصائيات ====== */ /* العنوان (العنصر الذي ننقر عليه) */ .side-title { font-size: 1em; /* تصحيح: من 1.em إلى 1em */ font-weight: bold; color: var(--dark-color); padding: 10px; border-bottom: 2px solid var(--accent-color); text-align: center; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: #f8f9fa; border-radius: 5px; margin-bottom: 5px; transition: background 0.3s ease; } .side-title:hover { background: #e9ecef; } /* الأيقونة في العنوان */ .side-title i { transition: transform 0.3s ease; font-size: 0.7em; color: var(--primary-color); } .side-title.collapsed i { transform: rotate(-90deg); /* دوران السهم عند الطي */ } /* الحاوية الرئيسية (القابلة للطي) */ .response-types-container { max-height: 600px; /* زيادة لتناسب الإحصائيات أيضاً */ overflow: hidden; transition: all 0.3s ease; /* تحسين الانتقال */ opacity: 1; padding: 0 10px; } /* الحالة المطوية */ .response-types-container.collapsed { max-height: 0 !important; opacity: 0; overflow: hidden; padding: 0 !important; margin: 0 !important; border: none !important; } /* محتوى أنواع الردود */ .response-types { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; margin-bottom: 15px; } /* أزرار أ/* محتوى أنواع الردود - شبكة أفقية */ .response-types-grid { display: grid; grid-template-columns: repeat(4, 1fr); /* 4 أعمدة */ grid-template-rows: repeat(2, auto); /* صفين */ gap: 8px; padding: 10px 0; margin-bottom: 15px; } /* أزرار أنواع الردود - مصغرة للعرض الأفقي */ .type-btn.compact { padding: 8px 5px; /* تقليل padding للتصغير */ border-radius: 8px; border: none; background: white; color: var(--dark-color); cursor: pointer; text-align: center; /* تغيير من right إلى center */ transition: all 0.3s; border: 1px solid #e0e0e0; font-size: 0.8em; /* تصغير حجم الخط */ display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60px; /* ارتفاع ثابت */ } .type-btn.compact:hover { background: var(--light-color); border-color: var(--primary-color); transform: translateY(-2px); /* تغيير من X إلى Y */ box-shadow: 0 3px 8px rgba(0,0,0,0.1); } .type-btn.compact.active { background: linear-gradient(to bottom, var(--primary-color), var(--dark-color)); /* to bottom بدلاً من to right */ color: white; border-color: transparent; } /* تنسيق الأيقونة والنص داخل الزر المصغر */ .type-icon { font-size: 1.2em; margin-bottom: 4px; display: block; } .type-text { font-size: 0.75em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } /* قسم الإحصائيات */ .conversation-stats { background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); margin-top: 10px; border: 1px solid #f0f0f0; } .stat-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #eee; } .stat-item:last-child { border-bottom: none; } .stat-value { font-weight: bold; color: var(--primary-color); font-size: 1.1em; } /* قسم الإحصائيات */ .conversation-stats { background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); margin-top: 10px; border: 1px solid #f0f0f0; } .stat-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #eee; } .stat-item:last-child { border-bottom: none; } .stat-value { font-weight: bold; color: var(--primary-color); font-size: 1.1em; } .type-btn { padding: 10px; border-radius: 10px; border: none; background: white; color: var(--dark-color); cursor: pointer; text-align: right; transition: all 0.3s; border: 1px solid #ddd; } .type-btn:hover { background: var(--light-color); border-color: var(--primary-color); transform: translateX(-5px); } .type-btn.active { background: linear-gradient(to right, var(--primary-color), var(--dark-color)); color: white; } .conversation-stats { background: white; padding: 15px; border-radius: 10px; box-shadow: var(--shadow); } .stat-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #ddd; } .stat-value { font-weight: bold; color: var(--primary-color); } .copyright { font-size: 0.8em; /* تم تعديله من 0.2em إلى 0.8em ليكون مقروءاً */ text-align: center; color: #6aaa66; padding-top: 15px; border-top: 1px solid #dd222d; direction: ltr; } /* Modal - نوافذ منبثقة */ .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100000; opacity: 0; visibility: hidden; transition: all 0.3s ease; } .modal-overlay.active { opacity: 1; visibility: visible; } .modal { background: white; border-radius: 1px; box-shadow: var(--shadow); width: 10%; max-width: 500px; max-height: 80vh; overflow: hidden; transform: translateY(20px); transition: transform 0.3s ease; } .modal-overlay.active .modal { transform: translateY(0); } .modal-header { padding: 15px 20px; background: linear-gradient(to right, var(--dark-color), var(--primary-color)); color: white; display: flex; justify-content: space-between; align-items: center; } .modal-header h3 { margin: 0; font-size: 1.2em; } .modal-close { background: none; border: none; color: white; font-size: 1.5em; cursor: pointer; } .modal-content { padding: 20px; overflow-y: auto; max-height: 80vh; } /* Comment Section - قسم التعليقات */ .comment-section { margin-top: 11px; border-top: 1px solid #eee; padding-top: 11px; } .comment-input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #ddd; margin-bottom: 10px; resize: vertical; min-height: 60px; font-family: inherit; } .emojis-container { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; padding: 10px; background: #f9f9f9; border-radius: 10px; max-height: 200px; overflow-y: auto; } .emoji-btn { font-size: 1.5em; background: none; border: none; cursor: pointer; padding: 5px; border-radius: 5px; transition: all 0.2s; } .emoji-btn:hover { background: #e0e0e0; transform: scale(1.2); } .comments-list { margin-top: 15px; max-height: 200px; overflow-y: auto; } .comment-item { background: #f5f5f5; padding: 10px; border-radius: 10px; margin-bottom: 8px; border-right: 3px solid var(--primary-color); } .comment-author { font-weight: bold; color: var(--dark-color); font-size: 0.9em; } .comment-text { margin-top: 5px; font-size: 0.9em; } .comment-emoji { display: inline-block; font-size: 1.2em; margin-right: 5px; } .comment-actions { display: flex; gap: 5px; margin-top: 8px; } .comment-action-btn { background: none; border: none; color: #666; font-size: 0.7em; cursor: pointer; padding: 2px 4px; border-radius: 3px; } .comment-action-btn:hover { background: #e0e0e0; } /* Reactions - ردود الفعل */ .reactions-container { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; } .reaction { background: rgba(255, 255, 255, 0.2); border-radius: 15px; padding: 3px 8px; font-size: 0.8em; display: flex; align-items: center; gap: 3px; border: 1px solid rgba(255, 255, 255, 0.3); } .reaction-emoji { font-size: 1em; } .reaction-count { font-size: 0.9em; } /* Responsive */ @media (max-width: 768px) { .chat-container { flex-direction: column; } .side-panel { width: 100%; border-left: none; border-top: 1px solid #ddd; max-height: 100px; } .header { flex-direction: column; gap: 10px; } .contact-info { font-size: 0.7em; } .message { max-width: 100%; } .quick-btn { min-width: 100px; max-width: 70px; font-size: 0.7em; padding: 4px 10px; } .modal { width: 130%; max-height: 150vh; } } /* ======= تحسينات التصميم الثابت ======= */ .container { max-width: 100%; height: 120vh; display: flex; flex-direction: column; position: relative; } .chat-container { flex: 1; display: flex; overflow: hidden; position: relative; } .chat-messages { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 120px; /* مساحة لمنطقة الإدخال */ } .input-area { position: fixed; bottom: 0; left: 0; right: 0; background: white; padding: 15px 20px; border-top: 2px solid #2e7d32; box-shadow: 0 -5px 20px rgba(0,0,0,0.1); z-index: 1000; } /* تحسينات الموبايل */ @media (max-width: 768px) { .chat-messages { padding-bottom: 150px; } .input-area { padding: 10px 15px; padding-bottom: env(safe-area-inset-bottom, 15px); } } /* قسم إدارة الردود */ .response-manager-container { padding: 10px; } .stats-box { background: #f8f9fa; border-radius: 8px; padding: 10px; margin-bottom: 10px; border: 1px solid #e9ecef; } .stat-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.85em; } .stat-row span:last-child { font-weight: bold; color: #2e7d32; } /* أزرار التحكم */ .response-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 15px; } .control-btn.small { padding: 8px 5px; font-size: 0.8em; display: flex; align-items: center; justify-content: center; gap: 5px; } /* قسم المعاينة */ .preview-section { background: white; border-radius: 8px; padding: 10px; border: 1px solid #e9ecef; } .preview-section h4 { margin: 0 0 10px 0; color: #333; font-size: 0.95em; } #responseCategorySelect { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 5px; margin-bottom: 10px; font-size: 0.9em; background: white; } .responses-preview { max-height: 200px; overflow-y: auto; border: 1px solid #eee; border-radius: 5px; padding: 10px; background: #fdfdfd; font-size: 0.85em; } .response-item { padding: 8px; margin-bottom: 8px; border-left: 3px solid #4CAF50; background: #f8fff8; border-radius: 4px; position: relative; } .response-item .response-category { font-size: 0.7em; background: #4CAF50; color: white; padding: 2px 6px; border-radius: 10px; position: absolute; top: -6px; right: -6px; } .response-item .response-text { margin: 5px 0; } .response-item .response-actions { display: flex; gap: 5px; margin-top: 5px; } .response-item .action-btn { background: none; border: none; color: #666; cursor: pointer; font-size: 0.8em; padding: 2px 5px; } .response-item .action-btn:hover { color: #2e7d32; } <style> /* أضف هذا في قسم الـ CSS */ المسابقات الإسلامية /* زر شبكة المسجد */ #masjidNetworkBtn { animation: pulseGreen 2s infinite; } @keyframes pulseGreen { 0% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(46, 125, 50, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); } } /* رسائل المجموعة */ .group-message { transition: all 0.3s ease; } .group-message:hover { transform: translateX(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); } /* قائمة الأصدقاء */ .peer-item { transition: all 0.3s ease; } .peer-item:hover { background: #e8f5e9 !important; transform: translateX(-5px); } /* زر المشاركة في المسجد */ .masjid-share-btn { background: linear-gradient(135deg, #2E7D32, #1B5E20) !important; } .masjid-share-btn:hover { background: linear-gradient(135deg, #1B5E20, #0D4D1A) !important; transform: translateY(-2px); } /* أنماط إضافية لنظام المسجد */ #masjidMainBtn { animation: float 3s ease-in-out infinite, glow 2s ease-in-out infinite alternate; } @keyframes glow { from { box-shadow: 0 8px 25px rgba(46, 125, 50, 0.5); } to { box-shadow: 0 8px 35px rgba(46, 125, 50, 0.8); } } .points-badge { animation: pulse 2s infinite; } .leaderboard-item { transition: all 0.3s ease; } .leaderboard-item:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); } .quiz-option { transition: all 0.3s ease; } .quiz-option:hover { transform: scale(1.02); } .audio-participant { animation: fadeIn 0.5s ease; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } </style>
حفظ تحميل مسح
</style>
        <div class="bot-avatar">
            <a class="fas fa-female"></a>
        </div>
        <div>
            <div class="bot-name"> اللّٓه ويعلمكم</div>
            <div class="bot-subtitle">       </div>
        </div>
    </div>
    <div class="contact-info">
        <i class="fas fa-phone-alt"></i> المطور  :أميرالدين الحيمي 
    </div>
<!-- Chat Area -->
<div class="chat-container">
    <div class="chat-messages" id="chatMessages">
        <div class="bot-message">
            السلام عليكم ورحمة الله وبركاته 🌹<br>
            أنا ادارة الحور، أسعد بمحادثتك. كيف يمكنني مساعدتك اليوم؟
            <div class="message-time">الآن</div>
            <div class="message-actions">
                <button class="action-btn" onclick="openCommentModal(this)">
                    <i class="far fa-comment-alt"></i>
                </button>
                <button class="action-btn" onclick="reactToMessage(this, '👍')">
                    <i class="far fa-thumbs-up"></i>
                </button>
                <button class="action-btn" onclick="reactToMessage(this, '❤️')">
                    <i class="far fa-heart"></i>
                </button>
                <button class="action-btn" onclick="reactToMessage(this, '😂')">
                    <i class="far fa-laugh"></i>
                </button>
            </div>
        </div>
    </div>
    
   
   
   
    
    <!-- Side Panel -->
أنواع الردود السريعة
<div class="response-types-container" id="responseTypesContainer">
    <!-- شبكة أفق<!-- ============================= -->
    <div class="response-types-grid" id="responseTypes">
        <button class="type-btn compact active" data-type="all" onclick="setResponseType('all')" title="كل الردود">
            <span class="type-icon">📁</span>
            <span class="type-text">الكل</span>
        </button>
        <button class="type-btn compact" data-type="moral" onclick="setResponseType('moral')" title="أخلاق وحكمة">
            <span class="type-icon">💡</span>
            <span class="type-text">أخلاق</span>
        </button>
        <button class="type-btn compact" data-type="story" onclick="setResponseType('story')" title="قصص وعبر">
            <span class="type-icon">📖</span>
            <span class="type-text">قصص</span>
        </button>
        <button class="type-btn compact" data-type="joke" onclick="setResponseType('joke')" title="نكت ومرح">
            <span class="type-icon">😂</span>
            <span class="type-text">نكت</span>
        </button>
        <button class="type-btn compact" data-type="advice" onclick="setResponseType('advice')" title="نصائح وإرشادات">
            <span class="type-icon">🗣️</span>
            <span class="type-text">نصائح</span>
        </button>
        <button class="type-btn compact" data-type="poem" onclick="setResponseType('poem')" title="شعر وأدب">
            <span class="type-icon">✍️</span>
            <span class="type-text">شعر</span>
        </button>
        <button class="type-btn compact" data-type="islamic" onclick="setResponseType('islamic')" title="دين التوحيد">
            <span class="type-icon">🕌</span>
            <span class="type-text">دين</span>
        </button>
        <button class="type-btn compact" data-type="science" onclick="setResponseType('science')" title="علوم ومعرفة">
            <span class="type-icon">🔬</span>
            <span class="type-text">علوم</span>
        </button>
    </div>
    
    
   
   
    <!-- الإحصائيات تبقى كما هي -->
    <div class="conversation-stats compact">
        <!-- محتوى الإحصائيات -->
    </div>
</div>
عدد رسائلك: 0
عدد ردود البوت: 1
الكلمات المرسلة: 0
مستوى الذكاء: 99%
        <div class="copyright">
            © 2023 شات حور - جميع الحقوق محفوظة<br>
            هاتف المطور: 00967770249963
        </div>
    </div>
</div>
الكلمات الجاهزة (انقر للطي/الفرد)
👋 مرحبا 🤔 كيف حالك 📖 قصة 💡 نصيحة أخلاقية 😂 نكتة 🌹 عن الصبر ✍️ قصيدة 🙏 شكرا 🔤 ما اسمك 📅 كيف يومك 🕌 حديث 💎 حكمة 🧠 معلومة 💭 تفسير حلم 👩‍👦 عن الأم 🚀 نصيحة نجاح 🍲 وصفة 🏠 عن الوطن 😄 نكتة يمن 📚 قصة قصيرة 🤝 عن الصداقة 🏥 نصيحة صحية 🔬 حقيقة علمية 🤲 عن التعاون 💰 نصيحة مالية 🕊️ عن التسامح ⭐ قصة نجاح 📚 عن العلم 💖 نصيحة عاطفية 💼 عن العمل 🤣 نكتة مضحكة 🌈 عن الأمل
    <div class="input-row">
        <input type="text" id="messageInput" placeholder="اكتب رسالتك هنا  العين..." autocomplete="off">
        <div class="voice-input" id="voiceInput" title="سجل رسالة صوتية">
            <i class="fas fa-microphone"></i>
        </div>
        <button class="send-btn" onclick="sendMessage()">
            <i class="fas fa-paper-plane"></i> إرسال
        </button>
    </div>
</div>

التعليقات وردود الفعل

        <div class="comment-section">
            <h4>أضف تعليقًا أو رد فعل:</h4>
            
            <div class="emojis-container" id="emojisContainer">
                <!-- سيتم ملؤها بالرموز التعبيرية -->
            </div>
            
            <textarea class="comment-input" id="commentInput" placeholder="اكتب تعليقك هنا..."></textarea>
            
            <div style="display: flex; gap: 10px; margin-top: 10px;">
                <button onclick="addComment()" style="flex: 1; padding: 10px; background: var(--primary-color); color: white; border: none; border-radius: 10px; cursor: pointer;">
                    <i class="fas fa-paper-plane"></i> إرسال التعليق
                </button>
                <button onclick="closeModal()" style="padding: 10px 20px; background: #ddd; border: none; border-radius: 10px; cursor: pointer;">
                    إلغاء
                </button>
            </div>
            
            <div class="comments-list" id="commentsList">
                <!-- سيتم ملؤها بالتعليقات -->
            </div>
        </div>
    </div>
</div>
<script> // أضف هنا ↓↓↓ // ==================== دالة تغيير نوع الردود ==================== function setResponseType(type) { // تحديث نوع الرد الحالي conversationStats.currentResponseType = type; // إزالة النشاط من جميع الأزرار const typeButtons = document.querySelectorAll('.type-btn'); typeButtons.forEach(btn => { btn.classList.remove('active'); }); // إضافة النشاط للزر المحدد const activeButton = document.querySelector(`.type-btn[data-type="${type}"]`); if (activeButton) { activeButton.classList.add('active'); } // إضافة رسالة توضيحية const typeNames = { 'all': 'جميع الردود', 'moral': 'الأخلاق والحكمة', 'story': 'القصص والعبر', 'joke': 'النكت والمرح', 'advice': 'النصائح والإرشادات', 'poem': 'الشعر والأدب', 'islamic': 'الإسلاميات', 'science': 'العلوم والمعرفة' }; // إضافة رسالة في الشات addMessage(`📂 تم تغيير نمط الردود إلى: ${typeNames[type] || type}`, 'bot'); } // ==================== نهاية الإضافة ==================== // قاعدة بيانات الحور العين - تحتوي على أكثر من 300 رد متنوع const responseDatabase = { // ردود أخلاقية وحكم (70 رد) moral: [ "الأخلاق الحسنة كنز لا يفنى، وذكرى لا تنسى.", "الخلق الحسن يذيب الخطايا كما تذيب الشمس الجليد.", "كن طيباً مع الآخرين، فالطيبون هم أقرب الناس إلى قلوب الآخرين.", "إنك لا تستطيع أن تمنع طيور الهم من التحليق فوق رأسك، ولكنك تستطيع أن تمنعها من التعشيش في رأسك.", "الرفق ما كان في شيء إلا زانه، وما نزع من شيء إلا شانه.", "الإنسان بأخلاقه، لا بماله أو جاهه.", "حسن الخلق يستر كثيراً من السيئات، كما أن سوء الخلق يغطي كثيراً من الحسنات.", "التواضع من أخلاق الكبار، والتعالي من صفات الصغار.", "الابتسامة صدقة، والكلمة الطيبة صدقة، والإحسان إلى الناس صدقة.", "خير الناس أنفعهم للناس.", "الصدق منجاة، والكذب مهواة.", "من تواضع لله رفعه، ومن تكبر وضعه.", "الأخلاق شجرة، جذورها في السماء، وثمارها في الأرض.", "الوفاء أجمل هدية تقدمها لمن تحب.", "التسامح علامة القوة، والانتقام علامة الضعف.", "العفو عند المقدرة من شيم الكرام.", "الحياء لا يأتي إلا بخير.", "الكرم يجلب المحبة، والبخل يجلب المقت.", "الصبر مفتاح الفرج.", "الرحمة تاج الأخلاق، والحلم زينتها.", "العدل أساس الملك، والظلم أساس الانهيار.", "الأمانة عزيزة على قلب المؤمن.", "الوفاء بالعهد من علامات الإيمان.", "الحياء شعبة من شعب الإيمان.", "الإحسان إلى الجار من كمال الإيمان.", "الاقتصاد في النفقة نصف المعيشة.", "التأني من الرحمن، والعجلة من الشيطان.", "اللين في القول يجلب المحبة.", "الغضب جمرة من نار، فأطفئها بالصبر.", "حسن الظن بالله يجلب الطمأنينة.", "الرضا بقضاء الله من أعلى مراتب الإيمان.", "الشكر على النعمة يزيدها.", "الصمت حكمة، وقليل فاعله.", "التفاؤل يبعد الهم، والتشاؤم يجلب الغم.", "الإيثار أعلى درجات الكرم.", "العطاء بلا مقابل يجلب البركة.", "التوكل على الله مع الأخذ بالأسباب.", "الهمة العالية تصل إلى القمة.", "التواضع للعلماء من أدب المتعلم.", "الاعتراف بالخطأ فضيلة.", "الاعتذار يمحو الذنوب.", "التقدير للآخرين يزيد المحبة.", "الاحترام يجلب الاحترام.", "المسامحة تطهر القلب.", "التفكير الإيجابي يجلب السعادة.", "الصدق مع النفس أول خطوات التغيير.", "الكلمة الطيبة صدقة جارية.", "البشاشة في وجه الأخ صدقة.", "إماطة الأذى عن الطريق صدقة.", "التعاون على البر والتقوى.", "نصرة المظلوم فرض على كل قادر.", "الإصلاح بين الناس من أفضل الأعمال.", "زيارة المريض تفرج الهم.", "مواساة المحتاج تذهب الغم.", "الستر على الناس يسترك الله.", "النصيحة سراً من علامات الإخلاص.", "الحرص على الوقت من علامات النجاح.", "التخطيط للمستقبل يضمن النجاح.", "الاعتدال في كل شيء خير.", "الاقتصاد في الكلام يقي الزلل.", "الاستماع للغير فن لا يتقنه الجميع.", "التفكر في خلق الله يزيد الإيمان.", "الشجاعة في قول الحق.", "الحلم عند الغضب من صفات الحكماء.", "الوفاء بالوعد من صفات المؤمنين.", "الاعتدال في المأكل والمشرب.", "النظافة من الإيمان.", "التنظيم في الحياة يريح البال.", "الاحترام للكبير والعطف على الصغير.", "الرفق بالحيوان من دلائل الرحمة." ], // قصص وعبر (50 قصة) story: [ "كان هناك رجل حكيم يعلم تلاميذه، فسأله أحدهم: كيف نعرف الصديق الحقيقي؟ فأخذ الحكيم تلاميذه إلى حديقة وأعطى كل واحد منهم تفاحة ناضجة وقال: اذهبوا إلى أصدقائكم وقولوا لهم أن هذه التفاحة فاسدة. ذهب التلاميذ وعادوا، فقال أحدهم: صديقي أخذ التفاحة ورمى بها وقال إنها فاسدة. وقال آخر: صديقي شكك في كلامي ولكنه أخذها. وقال ثالث: صديقي أخذ التفاحة ونظر إليها وقال: هذه التفاحة طيبة ولكن كلامك غير صحيح. فقال الحكيم: الصديق الحقيقي هو الذي يصحح خطأك ولا يصدق كذبتك.", "يحكى أن رجلاً كان يمشي في الصحراء فوجد جرّة ماء، وكان عطشاناً جداً، فشرب حتى ارتوى. ثم نظر فوجد بجانب الجرّة نبتة صغيرة ذابلة، فسكب عليها القليل من الماء. نمت النبتة وأصبحت شجرة كبيرة، أتت عليها الأيام وأصبح الرجل عائداً في الصحراء فوجد نفس الشجرة وقد أضلت عليه ظلاً في يوم قائظ، وأسقطت له ثماراً أزال بها جوعه. فقال في نفسه: الخير يعود على صاحبه ولو بعد حين.", "في إحدى القرى كان هناك شيخ حكيم يحبه الجميع. سأله شاب: كيف اكتسبت كل هذا الحب والاحترام؟ فطلب منه الشيخ أن يمشي معه في السوق. وفي الطريق، كان الشيخ يلقي التحية على كل من يقابله، يسأل عن أحوالهم، يمدح الصغير، يحترم الكبير، يساعد من يحتاج مساعدة. بعد نهاية الجولة، قال الشيخ للشاب: هذا هو السبب. الحب والاحترام لا يشترى بالمال، بل يكتسب بالإحسان إلى الناس.", "كان هناك ملك لديه بستان جميل، وكان يزرع فيه شجرة تفاح وحيدة تثمر تفاحاً ذهبياً. في أحد الأيام، لاحظ الملك أن التفاح الذهبي بدأ يختفي واحداً تلو الآخر. أمر الملك حراسه بالمراقبة، واكتشفوا أن لصاً صغيراً هو من يأخذ التفاح. أمسك الحراس باللص وأحضروه للملك. نظر الملك إلى الصبي وقال: لماذا تسرق؟ قال الصبي: أمي مريضة ولا يوجد لدي طعام أطعمها به. تأثر الملك بكلام الصبي، فأعطاه سلة مليئة بالتفاح الذهبي وقال: خذ هذه لأمك، ولكن وعدني ألا تسرق مرة أخرى. ثم أمر الملك بتعيين الصبي في قصره ليعلمه حرفة يعيش منها. فأصبح الصبي فيما بعد من أفضل الصناع في المملكة.", "يحكى أن تاجراً غنياً كان يسافر لتجارة، فترك عند صديقه صندوقاً وقال: هذا الصندوق أمانة عندك حتى أعود. مرت الأيام وتأخر التاجر في العودة. ففتح الصديق الصندوق فوجده مليئاً بالذهب. فكر في نفسه: لو أخذ هذا الذهب لصار غنياً. ولكنه تذكر الأمانة وأغلق الصندوق. بعد سنوات عاد التاجر، فأعطاه الصندوق كما هو. ففرح التاجر وقال: لقد جئت لأختبرك، وقد نجحت في الاختبار. وأعطاه نصف الذهب مكافأة على أمانته.", "في قديم الزمان، كان هناك رجلان يسيران في الصحراء. خلال الرحلة تخاصما، فصفع أحدهما الآخر. كتب الرجل الذي تلقى الصفعة على الرمال: اليوم صفعني صديقي. استمرا في السير حتى وصلا إلى واحة، فقررا الاستحمام. لكن الرجل الذي صفع غاص في الماء وكاد يغرق، فأنقذه صديقه. بعد أن خرج من الماء، كتب على حجر: اليوم أنقذ صديقي حياتي. سأله صديقه: لماذا كتبت على الرمال حين صفعتك، وتكتب على الحجر الآن؟ أجاب: عندما يؤذينا شخص ما، يجب أن نكتب ذلك على الرمال حيث رياح التسامح يمكنها محوه. ولكن عندما يفعل شخص ما شيئاً جيداً لنا، يجب أن ننقشه على حجر حيث لا يمكن لأي ريح أن تمحيه.", "كان هناك فلاح فقير يعمل في حقله، فوجد جرة مليئة بالذهب. فرح الفلاح كثيراً وظن أن حياته ستنقلب إلى الأفضل. ولكن بدلاً من أن يأخذ الجرة إلى بيته، فكر في صاحب الأرض الذي استأجر منه الحقل. ذهب الفلاح إلى صاحب الأرض وأعطاه الجرة. تفاجأ صاحب الأرض وقال: لقد وجدت الكنز في أرضك، فهو ملكك. فقال الفلاح: لا، الأرض ملكك فما فيها ملكك. فامتلك صاحب الأرض إعجاباً شديداً بأمانة الفلاح، فأعطاه نصف الذهب وجعله شريكاً له في الأرض. فصار الفلاح غنياً بسبب أمانته.", "في غابة بعيدة، كانت هناك شجرة تفاح كبيرة تثمر تفاحاً حلواً. جاءت قردة صغيرة وأخذت تتسلق الشجرة لتأكل التفاح. لكنها بدلاً من أن تأكل وحدها، نادت على بقية القردة لتشاركها الطعام. فجاءت القردة كلها وأكلت معاً. شاهدتهم نسر يعيش قريباً من الشجرة، فتعجب من تعاونهم. في اليوم التالي، جاء صياد ليصطاد القردة، فحذرهم النسر فاستطاعوا الهرب. فالعون في التعاون، والخير يعود على أصحابه.", "كان هناك شاب يحب القراءة والمعرفة، لكنه كان فقيراً ولا يستطيع شراء الكتب. فذهب إلى المكتبة وطلب من صاحبها أن يعمل عنده بدون أجر مقابل أن يقرأ الكتب. وافق صاحب المكتبة. كان الشاب يعمل نهاراً ويقرأ ليلاً. بعد سنوات، أصبح الشاب عالماً مشهوراً. زاره صاحب المكتبة يوماً فوجده يكتب كتاباً. قال له: هذا الكتاب هدية لك شكراً على ما قدمته لي. فصار الكتاب من أشهر الكتب في تلك الفترة، وكسب صاحب المكتبة مالاً كثيراً من بيعه.", "يحكى أن رجلاً كان يملك بئر ماء في الصحراء. كان المسافرون يمرون ببئره ليشربوا. في أحد الأيام، قرر الرجل أن يطلب مالاً من كل من يشرب من بئره. فصار الناس يتجنبون بئره ويذهبون إلى بئر آخر مجاني بعيد عنه. فخسر الرجل كل المسافرين ولم يعد أحد يأتي إليه. ندم الرجل على طمعه، فأعلن أن الماء مجاني مرة أخرى. فعاد الناس إليه، وصاروا يشترون منه المؤن والطعام، فصار يكسب أكثر مما كان يكسب عندما كان يبيع الماء.", "في قرية صغيرة، كان هناك رجل عجوز يعيش وحيداً. كل يوم كان يجلس أمام بيته ويشاهد الناس يمرون. لم يكن يتكلم مع أحد، وكان الناس يتجنبونه. جاء شاب جديد إلى القرية، فسأل عن الرجل العجوز. قالوا له: إنه رجل غريب الأطوار. لكن الشاب قرر أن يزوره. جلس معه وحدثه، فاكتشف أن الرجل العجوز كان عالماً كبيراً، ولكنه انعزل بعد وفاة أسرته. أصبح الشاب يزوره كل يوم، ويتعلم منه الحكمة والعلم. بعد فترة، انتشر خبر العالم العجوز، فصار الناس يزورونه ليتعلموا منه. فعادت إليه الحياة بسبب شاب واحد قرر أن يتحدث معه.", "كان هناك تاجر يسافر كثيراً، وفي كل مرة يعود يجلب هدايا لأولاده. في إحدى الرحلات، اشترى لهم بذور نادرة وقال: من يزرع بذرته ويعتني بها، سأكافئه بهدية خاصة. زرع الابن الأكبر بذرته ولكنه أهملها فماتت. زرع الابن الثاني بذرته واعتني بها قليلاً فنمت ولكنها ذبلت. زرع الابن الأصغر بذرته واعتني بها جيداً، فصارت شجرة جميلة. عندما عاد الأب، كافأ الابن الأصغر بهدية ثمينة وقال: الهدية الحقيقية ليست الشجرة، بل الصبر والاعتناء الذي تعلمته من زراعتها.", "يحكى أن صياداً كان يصطاد السمك كل يوم ليبيعها في السوق. في أحد الأيام، اصطاد سمكة ذهبية نادرة. قال له رجل غني: سأشتري هذه السمكة منك بمبلغ كبير. فكر الصياد وقال: هذه السمكة نادرة وسأربح من بيعها أموالاً كثيرة. لكنه تذكر أن السمكة ستموت إذا لم تكن في الماء. فقرر أن يطلقها في البحر. فرحت السمكة وقالت له: لأنك أطلقت سراحي، سأمنحك أمنية. تمنى الصياد أن يكون صياداً ناجحاً. ومن ذلك اليوم، كان يصطاد الكثير من السمك دون تعب، وعاش حياة سعيدة.", "في مملكة بعيدة، كان هناك ملك عادل يحكم شعبه بالحكمة. في عيد ميلاده، أقام الملك مسابقة لأبناء المملكة. طلب الملك من كل شاب أن يأتي بهدية تمثل المملكة. جاء الشباب بهدايا ثمينة من ذهب وفضة وأحجار كريمة. جاء شاب فقير ومعه كيس تراب. ضحك الجميع عليه. سأله الملك: ما هذا؟ قال الشاب: هذا تراب من كل قرية في مملكتك. هو رمز للأرض التي تحكمها، وللشعب الذي يعيش عليها. أعجب الملك برد الشاب، وقال: هذه أفضل هدية، لأنها تمثل حبك لوطنك. وعين الشاب مستشاراً له.", "كان هناك رجل ثري جداً، لكنه كان بخيلاً لا يعطي الفقراء. في ليلة من الليالي، حلم أنه في يوم القيامة وهو يحمل أمواله على ظهره، فكانت ثقيلة جداً حتى سقط تحت ثقلها. استيقظ الرجل مذعوراً، فقرر أن يتغير. بدأ بتوزيع أمواله على الفقراء، وبنى مدرسة ومستشفى. فصار محبوباً من الناس، وعاش سعيداً بقلب خفيف.", "في إحدى المدن، كان هناك حداد يعمل بجد ويصنع أفضل السيوف. جاء إليه فارس وقال: أريد سيفاً لا يقاوم. صنع الحداد السيف وأعطاه للفارس. بعد أيام، عاد الفارس غاضباً وقال: سيفك انكسر في المعركة. فسأله الحداد: كيف استخدمته؟ قال الفارس: ضربت به الحجارة والجدران. ضحك الحداد وقال: يا سيدي، السيف يصنع ليقاتل الأعداء، لا ليكسر الحجارة. كل شيء له استخدامه المناسب.", "كان هناك طالب مجتهد في المدرسة، لكنه كان يخشى الاختبارات. في أحد الاختبارات، قرر أن يغش. لكن عندما جلس في الامتحان، تذكر نصيحة معلمه: الأمانة في الصغر تدوم في الكبر. فقرر أن يعتمد على نفسه. رسب في ذلك الاختبار، لكنه تعلم درساً قيماً. في الاختبارات التالية، اجتهد ونجح بامتياز. وعندما كبر، أصبح معلماً يذكر طلابه دوماً بقيمة الأمانة.", "يحكى أن نهراً كان يجري بين قريتين. كان سكان القريتين يتخاصمون على ماء النهر. في سنة جفاف، قل ماء النهر جداً. اجتمع شيوخ القريتين وتشاوروا. قال شيخ حكيم: بدلاً من أن نتشاجر على الماء القليل، لماذا لا نحفر قناة تجمع مياه الأمطار لتغذي النهر؟ وافق الجميع على الفكرة. عملوا معاً وحفروا القناة، فعاد النهر إلى حياته. وعاش أهل القريتين في سلام وتعاون بعد ذلك.", "كان هناك بائع متجول يبيع العسل. في يوم حار، تعب البائع وجلس تحت شجرة ليستريح. نام واستغرق في النوم. جاءت نحلات إلى عسله وأكلت منه. عندما استيقظ، وجد النحل على عسله. بدلاً من أن يغضب، فكر وقال: النحل صنع هذا العسل، فمن حقه أن يأكل منه. من ذلك اليوم، كان يضع قليلاً من العسل بعيداً عن عربته للنحل. فصار النحل يترك عربته ولا يأكل من عسله. فتعلم أن العطاء حتى للنحل يجلب الخير.", "في قرية صغيرة، كان هناك رجل يملك بستان برتقال. كان الرجل كريماً يعطي جيرانه من البرتقال. ذات مرة، مرض الرجل ولم يستطع الاعتناء ببستانه. فجاء جيرانه واعتنوا بالبستان بدلاً عنه. وعندما شفي، وجد البستان أفضل مما كان. فقال: الخير الذي تعطيه يعود إليك مضاعفاً.", "كان هناك صبي صغير يحب الطيور، فصنع لها بيتاً صغيراً ووضع فيه الطعام. جاءت الطيور وأكلت من الطعام. في أحد الأيام، سقط الصبي في بئر عميق، فسمعت الطيور صراخه وحلقت عالياً ونادت على المزارعين الذين أنقذوا الصبي. فقال أبوه: لأنك أحسنت إلى الطيور، أنقذتك الطيور.", "في مملكة قديمة، كان هناك ملك يحب الحكمة. جمع الحكماء وسألهم: ما أعظم كنز في الدنيا؟ قال أحدهم: الذهب. وقال آخر: المجوهرات. وقال ثالث: القصور. لكن حكيماً عجوزاً قال: الوقت. تعجب الملك وسأل: لماذا الوقت؟ قال العجوز: لأن الذهب يمكنك جمعه مرة أخرى إذا فقدته، لكن الوقت إذا ذهب لا يعود. فأدرك الملك قيمة الوقت وأصبح يقسم وقته بين العائلة والعمل والراحة.", "يحكى أن راعياً كان يرعى غنمه في الجبل. في ليلة قاسية، ضاع خروف صغير. بحث الراعي عنه طوال الليل حتى وجده في مكان آمن. قال له الخروف: لماذا تبحث عني وأنا خروف واحد فقط؟ فقال الراعي: كل واحد من غنمي له قيمة، ولن أترك أي واحد يضيع. فتعلم الخروف أن كل فرد له أهميته.", "كان هناك نجار ماهر يعمل في صناعة الأثاث. طلب منه رجل ثري أن يصنع له خزانة. عمل النجار بجد وأتقن الخزانة. لكنه أخفى جزءاً من الخلف ولم ينتهيه تماماً. عندما جاء الرجل ليرى الخزانة، أعجب بها ودفع الثمن. قال له النجار: الخزانة جميلة من الأمام، لكن الخلف غير منتهٍ. خجل النجار واعتذر، وأكمل الخزانة بإتقان. وتعلم أن الإتقان في كل شيء حتى في ما لا يراه الناس.", "في غابة بعيدة، كانت هناك شجرة ضخمة تظلل الحيوانات. في يوم عاصف، كسرت الرياح أحد أغصانها الكبيرة. حزنت الشجرة، لكن الحيوانات الصغيرة جاءت وأخذت الأغصان المكسورة وبنيت منها بيوتاً. فرحت الشجرة وقالت: حتى في ألمي، كان هناك فائدة لغيري.", "كان هناك تاجر يمتلك متجراً صغيراً. جاءه رجل يريد شراء بضاعة لكنه لم يكن معه مال. قال له التاجر: خذ ما تحتاجه وادفع لي عندما تستطيع. بعد أشهر، عاد الرجل ودفع له وأحضر معه زبائن جدد. فازدهر متجر التاجر بسبب ثقته بالناس.", "يحكى أن عصفوراً صغيراً كان يحاول الطيران لكنه كان يخاف. شجعه أمه وقالت: حاول وسأكون معك. حاول العصفور وسقط. حاول مرة أخرى وسقط. في المرة الثالثة، استطاع الطيران. فتعلم أن المحاولة هي مفتاح النجاح.", "في قرية نائية، كان هناك بئر ماء يجف. اجتمع أهل القرية وقرروا حفر بئر جديد. عملوا معاً لأسابيع حتى وجدوا الماء. فرحوا وقالوا: التعاون يصنع المعجزات.", "كان هناك رجل يعمل في مكتب صغير. كل يوم كان يأتي مبكراً وينظم مكتبه ويعمل بإخلاص. لاحظ المدير اجتهاده، فرفعه إلى منصب أعلى. وقال له: ليس الذكاء وحده هو ما يجعلك ناجحاً، بل الالتزام والإخلاص.", "يحكى أن طفلاً كان يجمع النجوم البحرية على الشاطئ ويقذفها إلى البحر. سأله رجل: لماذا تفعل ذلك ولن تستطيع إنقاذ كل النجوم؟ أجاب الطفل: لكني أنقذت هذه، وهذه مهمة لها. فتعلم الرجل أن الأعمال الصغيرة لها قيمتها.", "كان هناك مزارع يزرع القمح. في سنة القحط، احتفظ بجزء من حصاده ليزرعه السنة القادمة. قال له جاره: لماذا لا تبيعه وتكسب مالاً؟ أجاب المزارع: لأنني أفكر في المستقبل. في السنة التالية، كان القحط عاماً، فباع المزارع قمحه بثمن عالٍ وأنقذ عائلته. فتعلم جاره أهمية التخطيط للمستقبل.", "في مدينة كبيرة، كان هناك رجل فقير يعزف على آلة موسيقية في الشارع. كان الناس يمرون ولا يعطونه شيئاً. في أحد الأيام، توقف رجل ثري واستمع لعزفه ثم أعطاه مالاً كثيراً. قال له الفقير: لماذا أعطيتني كل هذا؟ قال الرجل: لأنك تذكرتني بوالدي الذي كان يعزف مثل هذا العزف. فتعلم الفقير أن الفن يربط القلوب.", "كان هناك صياد سمك يبيع سمكه في السوق. في أحد الأيام، أحضر سمكة نادرة. عرضها للتجار فتنافسوا على شرائها. لكن الصياد أعطاها لرجل فقير كان جائعاً. قالوا له: لقد خسرت مالاً كثيراً. أجاب: لكنني ربحت رضا نفسي.", "يحكى أن نباتاً صغيراً نبت بين الصخور. حاولت الصخور منعه من النمو، لكن النبات استمر في النمو حتى كسر الصخور ووصل إلى الشمس. فتعلم أن الإصرار يقهر كل الصعاب.", "كان هناك طبيب يعالج الفقراء بدون مقابل. سأله أحدهم: لماذا تفعل ذلك؟ أجاب: لأن الله سيسألني عما قدمت للناس، ولا أريد أن أكون فارغ اليدين.", "في مدرسة صغيرة، كان هناك معلم يهتم بطلابه الفقراء. كان يجلب لهم الطعام والملابس. بعد سنوات، أصبح طلابه أطباء ومهندسين وعادوا لشكر معلمهم. فقال المعلم: زرعت بذرة طيبة فحصدت ثماراً طيبة.", "كان هناك رجل يشتكي دائماً من فقره. في أحد الأيام، رأى رجلاً بلا ساقين وهو سعيد. فخجل من شكواه وشكر الله على نعمه.", "يحكى أن نهراً كان يتدفق بقوة، فحفر مجرى عميقاً في الأرض. قال له البحر: أنت قوي وجميل. قال النهر: قوتي من استمراري، وجمالي من صبري على طول الطريق.", "كان هناك فنان يرسملوحات رائعة لكنه كان خجولاً ولا يعرضها. شجعته أمه فعرض لوحاته، فصار مشهوراً. فتعلم أن الخجل قد يخفي موهبة عظيمة.", "في مملكة بعيدة، كان الملك يختار وزراءه من المتعلمين والأمناء. قال له أحد الحكماء: العلم بلا أمانة كالسيف بلا مقبض، قد يؤذي صاحبه.", "كان هناك بستان به أشجار مثمرة، لكن صاحب البستان كان يهملها فلم تثمر. جاء بستاني ماهر واعتني بالأشجار، فعادت تثمر من جديد. فتعلم صاحب البستان أن العناية تولد الإنتاج.", "يحكى أن غيمة صغيرة كانت تحمل ماء المطر. رأت الأرض الجافة فقررت أن تمطر عليها. فرحت الأرض وأنبتت زرعاً. فقالت الغيمة: العطاء بلا انتظار المقابل هو أجمل العطاء.", "كان هناك طائر يغرد كل صباح. سأله طائر آخر: لماذا تغرد وأنت تعيش في قفص؟ أجاب: لأن صوتي يصل إلى السماء، والقفص لا يحبس أمنياتي.", "في قرية صغيرة، كان الأهالي يبنون بيتاً لأرملة فقيرة. تعاونوا جميعاً وأكملوا البيت في وقت قصير. فقالت الأرملة: يد واحدة تصفق، لكن الأيدي المتعددة تبني بيوتاً.", "كان هناك تاجر يسافر للتجارة ويترك أولاده. قال لهم قبل سفره: الأمانة في الغياب علامة الصدق. وعندما عاد، وجد أنهم حفظوا الأمانة، فكافئهم وفرح بهم.", "يحكى أن نبع ماء صغيراً كان يتدفق من الجبل. ظن أنه لا قيمة له. لكنه مع الوقت كون نهراً عظيماً. فتعلم أن القليل المستمر يصنع الكثير.", "كان هناك طفل يخاف من الظلام. أعطته أمه مصباحاً صغيراً وقالت: النور يطرد الظلام ولو كان صغيراً. فشجعه المصباح ولم يعد يخاف.", "في يوم شديد الحرارة، جلست شجرة ظليلة تستقبل الناس تحتها. شكرتها الطيور والحيوانات والإنسان. فقالت الشجرة: وجودي لأجل غيري هو معنى سعادتي.", "كان هناك رجل يحمل صخرة كبيرة ويشتكي من ثقلها. مر به رجل حكيم وقال: لماذا لا تتركها؟ أجاب: لأنني اعتدت على حملها. فقال الحكيم: بعض الأعباء نحملها لأننا تعودنا عليها، وليس لأننا مضطرون لها.", "يحكى أن نجماً صغيراً في السماء كان يحلم بأن يصير كوكباً كبيراً. سخرت منه النجوم الأخرى. لكنه استمر في البريق حتى لاحظه الفلكيون وسموه باسم خاص. فتعلم أن الأحلام تتحقق بالإصرار.", "كان هناك بحار يخاف من البحر. لكنه كان يحب صيد السمك. تخطى خوفه وركب القارب. في أول رحلة، اصطاد كثيراً من السمك. فقال: الخوف قد يمنعنا من كنوز الحياة.", "في حديقة عامة، كان هناك زهرة جميلة تنمو بين الأحجار. قال لها أحد الزوار: أنت جميلة رغم صعوبة مكانك. أجابت الزهرة: الجمال ينبع من الداخل، والمكان لا يحدده.", "كان هناك ساعة قديمة توقفت عن العمل. أصلحها صانع ساعات ماهر، وعادت تدق من جديد. فقالت الساعة: كل شيء يحتاج إلى من يعتني به.", "يحكى أن ريحاً شرقية وريحاً غربية تباريتا أيهما أقوى. اتفقتا على من يستطيع نزع عباءة من رجل يمشي. حاولت الريح الشرقية بقوة فتشبث الرجل بعباءته. جاءت الريح الغربية بنسيم لطيف فدفء الرجل ونزع عباءته بنفسه. فتعلمتا أن اللين أقوى من القوة أحياناً.", "كان هناك رجل يعيش في بيت صغير لكنه كان سعيداً. جاءه جاره الثري وقال: لماذا لا تبيع بيتك وتبني بيتاً أكبر؟ أجاب: سعادتي ليست في حجم البيت، بل في راحة القلب.", "في غابة كثيفة، كان هناك ضوء صغير ينبعث من حشرة مضيئة. في ظلام الليل، كان هذا الضوء يدل الحيوانات على الطريق. فقالت الحشرة: حتى الضوء الصغير له أهميته في الظلام." ], // نكت ومرح (40 نكتة) joke: [ "سأل المعلم تلميذه: إذا كان لديك 10 تفاحات وأخذت منك 4، فماذا بقي؟ فقال التلميذ: بقي صاحب التفاحات يلحق الذي أخذها!", "قال الأب لابنه: لماذا تهرب من المدرسة؟ قال الابن: لأن نصف الطلاب غائبين والنصف الآخر مشغولين باللعب، فلمن سأدرس؟", "سأل رجل صديقه: لماذا تضع السماعة في أذنك وأنت لا تستمع لأي شيء؟ قال: لأتجنب سماع النصائح غير المرغوب فيها!", "ذهبت إلى الطبيب واشتكيت من أنني أنسى كثيراً، فقال: متى بدأت هذه المشكلة؟ فقلت: أي مشكلة؟", "قالت الأم لابنها: يجب أن تشارك ألعابك مع أصدقائك. فرد الابن: لكني أشاركهم مشاكلي أيضاً!", "سأل الولد أباه: أبي، لماذا السماء زرقاء؟ فقال الأب: إذا توقفت عن الأسئلة سأشتري لك آيس كريم. قال الولد: أبي، لماذا توقف الآيس كريم عن الكلام؟", "رن جرس الهاتف، فقال الولد: ألو؟ قال المتصل: هل أبوك موجود؟ قال الولد: نعم. قال المتصل: هل أستطيع التكلم معه؟ قال الولد: لا. قال المتصل: ولماذا؟ قال الولد: لأنك تتكلم معي!", "قال المعلم للطالب: لماذا تأخرت عن المدرسة؟ قال الطالب: كنت أسير خلف سلحفاة حتى لا أتأخر!", "سألت الأم ابنها: ماذا تعلمت في المدرسة اليوم؟ قال: تعلمت كيف أتحدث بدون أن أفتح فمي!", "ذهب رجل إلى الطبيب وقال: دكتور، أنا أشعر أنني كوب شاي! فقال الطبيب: لماذا لا تجلس في الغرفة الأخرى حتى تبرد قليلاً؟", "سأل التلميذ المعلم: هل يمكن أن أعاقب على شيء لم أفعله؟ قال المعلم: بالطبع لا. قال التلميذ: جيد، لأني لم أكلف واجبي!", "قال الطفل لأبيه: أبي، رأيت في الحلم أنك اشتريت لي دراجة! فقال الأب: حسنٌ، سترى في الحلم أنك تركبها!", "سألت المرأة زوجها: هل أبدو أكبر سناً؟ قال الزوج: لا، ولكن من أي عمر تريدين أن تبدئي؟", "ذهب رجل إلى المكتبة وسأل: أين كتب التنمية البشرية؟ قال الموظف: إنها في القسم الذي لم تصل إليه بعد!", "قال الأب لابنه: لماذا تأخذ الكتاب إلى الحمام؟ قال الابن: لأن المعلم قال إن القراءة تفتح الآفاق!", "سأل الرجل سائق التاكسي: هل تعرف طريق المدينة؟ قال السائق: نعم. قال الرجل: عظيم، لأنني نسيتها!", "قالت الزوجة لزوجها: لقد اشتريت لك هدية ستزيد من سرعتك بنسبة 50٪! ففرح الزوج حتى رأى الدراجة الهوائية!", "سأل الولد والده: لماذا تضع النقود في الحافظة؟ قال الأب: لأمنعها من الطيران!", "قال الطالب للمعلم: أنا لا أخاف من أي شيء! قال المعلم: حقاً؟ قال الطالب: نعم، حتى الواجبات المنزلية!", "ذهب رجل إلى مطعم وأمر النادل: أحضر لي شطيرة دجاج. قال النادل: أعتذر، لقد نفذ الدجاج. قال الرجل: إذن أحضر لي بيضة دجاج!", "سألت الأم ابنها: ماذا تريد أن تصبح عندما تكبر؟ قال: أريد أن أصبح رجلاً سعيداً مثل أبي! فقال الأب: أنا لست سعيداً! قال الابن: بالضبط!", "قال الرجل لصديقه: زوجتي تتجادل مع المرآة! قال الصديق: لماذا؟ قال: لأن المرآة تقول إنها أكبر سناً!", "سأل الطالب أستاذه: هل يمكن للإنسان أن يعيش بدون دماغ؟ قال الأستاذ: نعم، عندما يكون في قالة الامتحان!", "قال الأب لابنه: لماذا تخفي النقود تحت الوسادة؟ قال الابن: لأنك قلت إن النقود تحت الوسادة تجلب الأحلام الجميلة!", "ذهب رجل إلى الطبيب وقال: دكتور، كلما عطست أرى أضواء! قال الطبيب: هل جربت أن تغمض عينيك عندما تعطس?", "سأل المعلم: ما هو الحيوان الذي ينام وأحد عينيه مفتوحة؟ قال الطالب: السمكة يا معلم، لأنها لا تستطيع إغلاق عينيها!", "قال الولد لأبيه: أبي، المعلم سألني من اكتشف أمريكا؟ قلت له: أنا لا أعرف. فغضب مني! فقال الأب: في المرة القادمة قل له: أنت تعرف ولم تخبرني!", "سألت المرأة البائع: كم عمر هذه الدجاجة؟ قال البائع: لا أعرف، أنا لا أسألها عن عمرها!", "قال الأب لابنه: لماذا تأكل بيدك اليسرى؟ قال الابن: لأن اليمنى مشغولة بالإمساك بالصحن!", "ذهب رجل إلى المكتب ونسي ماذا يريد. فقال لزميله: إذا تذكرت ماذا أريد، قل لي! فقال الزميل: تريد أن تتذكر!", "سأل التلميذ المعلم: لماذا ندرس التاريخ؟ قال المعلم: حتى لا نكرر أخطاء الماضي! قال التلميذ: ولكننا نكررها في الامتحانات!", "قال الطفل لأمه: أمي، المعلمة قالت إنني أتحدث كثيراً في الصف! فقالت الأم: وماذا قالت بالضبط؟ قال الطفل: لم أسمع لأنني كنت أتحدث!", "سأل الرجل صديقه: لماذا تشتري كل هذه الكتب؟ قال الصديق: لأملأ المكتبة! قال الرجل: ولكنك لا تقرأها! قال الصديق: ولا الكتب التي في المكتبة تقرأ نفسها!", "قال الولد لأبيه: أبي، سمعت أن الحشرات تأكل 10% من محاصيل العالم! قال الأب: لا تقلق، نحن نأكل 90% من الحشرات في النوم!", "ذهب رجل إلى حديقة الحيوان وسأل الحارس: متى ينام الأسد؟ قال الحارس: عندما ينتهي من مشاهدة الزوار!", "سأل المعلم: من يستطيع أن يعطيني مثالاً على الصدفة؟ قال الطالب: والدي ووالدتي التقيا بالصدفة!", "قال الأب لابنه: لماذا تأكل الشوكولاتة قبل العشاء؟ قال الابن: لأن العشاء ليس جاهزاً بعد!", "سأل الولد والده: أبي، لماذا السمك لا يغرق؟ قال الأب: لأنه يعرف السباحة!", "قال الرجل لطبيبه: دكتور، أنا أشعر أنني غير مرئي! قال الطبيب: من قال هذا؟ قال الرجل: لا أحد!", "ذهب طفل إلى المتجر واشترى لعبة. قال البائع: هذه اللعبة مناسبة للأطفال من عمر 8 إلى 12 سنة. قال الطفل: عظيم، سألعب بها لمدة 4 سنوات!" ], // نصائح وإرشادات (45 نصيحة) advice: [ "لا تؤجل عمل اليوم إلى الغد، فالوقت كالسيف إن لم تقطعه قطعك ونت اخبر بروحك.", "تعلم من الأمس، وعش اليوم، وكن متفائلاً بشأن الغد.", "القراءة غذاء العقل، كما أن الطعام غذاء الجسد.", "حافظ على صلاتك، فهي عماد الدين وسبب للطمأنينة.", "كن صادقاً مع نفسك أولاً، ثم مع الآخرين.", "تعلم لغة جديدة تفتح لك عالماً جديداً.", "الرياضة ليست للجسد فقط، بل للعقل والروح أيضاً.", "السفر يزيدك علماً وتجربة ويفتح آفاقك.", "حافظ على علاقتك بأهلك، فهم سندك في الدنيا.", "كن لطيفاً مع والديك، فقد ضحيا من أجلك كثيراً.", "الاستيقاظ المبكر يجلب البركة ويوسع الوقت.", "التخطيط اليومي ينظم حياتك ويوفر وقتك.", "حافظ على ترتيب غرفتك، فالنظام في البدايات.", "تعلم مهارة جديدة كل سنة، تزداد قيمتك.", "كن متسامحاً، فالتسامح يريح القلب.", "لا تتحدث وأنت غاضب، فالكلام في الغضب يندم عليه.", "استمع أكثر مما تتكلم، تكن حكيماً.", "ابتعد عن الغيبة والنميمة، فهما يحبان الفتنة.", "ساعد المحتاج ولو بكلمة طيبة.", "كن ممتناً للنعم التي لديك.", "حافظ على صحتك، فهي تاج على رؤوس الأصحاء.", "اشرب الماء بكثرة، فهو ينقي الجسم.", "تناول الخضروات والفواكه الطازجة.", "نم مبكراً، فالنوم المبكر يرطب البشرة وينشط العقل.", "اقرأ القرآن يومياً، فهو نور للقلب.", "حافظ على الوضوء، فهو طهارة للجسد والروح.", "تصدق ولو بالقليل، فالصدقة تدفع البلاء.", "أدعو الله في السجود، فهو أقرب ما يكون العبد من ربه.", "احترم معلميك، فهم سبب علمك.", "كن لطيفاً مع إخوانك، فهم سندك.", "لا تستهين بالعلم أبداً، فهو سلاح الحياة.", "تعلم من أخطائك، فلا تكررها.", "كن شجاعاً في قول الحق.", "لا تخشى الفشل، بل اخشى عدم المحاولة.", "كن متفائلاً، فالتفاؤل يجلب الخير.", "ابتسم في وجه أخيك، فالابتسامة صدقة.", "لا تحقد على أحد، فالحقد يمرض القلب.", "كن متواضعاً، فالتواضع يرفع القدر.", "احترم آراء الآخرين حتى لو اختلفت معها.", "تعلم فن الإصغاء، فهو يجلب المحبة.", "لا تكن متسرعاً في قراراتك.", "فكر قبل أن تتكلم، تكن محبوباً.", "كن صبوراً، فالصبر جميل.", "لا تيأس، فبعد العسر يسر.", "احلم كبيراً واعمل بجد لتحقيقه." ], // شعر وأدب (30 قصيدة) poem: [ "اصبر على مر الجفا من معاشرٍ .. فربما صحت الأحبة بعد البعدِ
لا تيأسَنَّ من الحياة ولو كظُّمت .. فربما انفرجت الشدائد في الغدِ", "كن بلسماً إن صار دهرك أرقما .. واحلم إذا ما عابك الدهرُ وسلما
واحفظ لسانك إن نطقت ولا تكن .. مغرىً بالوقيعة إن قلتَ أو كَلِما", "إن الجمالَ جمالُ العلمِ والأدبْ .. ليس الجمالُ جمالَ الثوبِ والقلبْ
كم من قبيحٍ قبحُ الخلقِ أذهبَ ما .. يحوي من الجمالِ في ثوبٍ مُهَذَّبْ", "إذا المرءُ لا يرعاك إلا تكلفاً .. فدعه ولا تكثر عليه التأسفا
ففي الناس أبدال وفي الترك راحةٌ .. وفي القلب صبر للحبيب ولو جفا", "ولا خير في ودِّ امرئ متلوِّنٍ .. إذا الريح مالت مال حيث تميل
ما أكثر الإخوان حين تعدهم .. ولكنهم في النائبات قليل", "عش عزيزاً أو مت وأنت كريم .. بين طعن القنا وخفق البنود
لا تسأل المرء عن أخلاقه .. في وجهه ما ينطق به اللسان", "وطني لو شغلت بالخلد عنه .. نازعتني إليه في الخلد نفسي", "أماويَّ إن المال غادٍ ورائحٌ .. ويبقى من المال الأحاديث والذكر
أماويَّ إن المال يذهب نفعه .. ويبقى الذي قدَّمته من حسن الأثر", "لا تشكي للناس جرحاً أنت صاحبه .. لا يؤلم الجرح إلا من به ألم", "إذا أنت أكرمت الكريم ملكته .. وإن أنت أكرمت اللئيم تمردا", "ومن يجعل المعروف في غير أهله .. يكن حمده ذماً عليه ويندم", "ومن هاب أسباب المنايا ينلنه .. ولو رام أسباب السماء بسلم", "ومن لا يحب صعود الجبال .. يعش أبد الدهر بين الحفر", "إذا غامرت في شرف مروم .. فلا تقنع بما دون النجوم", "وما نيل المطالب بالتمني .. ولكن تؤخذ الدنيا غلابا", "وطني إن شغلت بالخلد عنه .. نازعتني إليه في الخلد نفسي", "يا ويح من يبني المجد على .. مال يجمع من حرام فيندم", "ذو العقل يشقى في النعيم بعقله .. وأخو الجهالة في الشقاوة ينعم", "لا تحسبن المجد تمراً أنت آكله .. لن تبلغ المجد حتى تلعق الصبرا", "إذا أنت لم تعرف لك القديم فضلاً .. فما أنت إلا حديث كل يوم", "وما الحسب الموروث غير وسام .. على صدر من لا يحسن الكلام", "إذا كنت في حاجة مرسلاً .. فأرسل حكيماً ولا توصه", "أحسن إلى الناس تستعبد قلوبهم .. فطالما استعبد الإنسانَ إحسان", "ولرب نازلة يضيق بها الفتى .. ذرعاً وعند الله منها المخرج", "إذا المرء أعيته المروءة ناشئاً .. فمطلبها كهلاً عليه عسير", "ومن لم يذق مر التعلم ساعة .. تجرع ذل الجهل طوال حياته", "ولو أن الحياة تبقى لحيٍ .. لعددنا أضلنا الشجعانا", "ولا خير في ود امرئ متلون .. إذا الريح مالت مال حيث تميل", "إذا القوم قالوا من فتى خلت أنني .. عنيت فلم أكسل ولم أتكاسل", "ألم تر أن السيف ينقص قدره .. إذا قيل إن السيف أمضى من العصا" ], // إسلاميات (30 رداً) islamic: [ "الله لا يغير ما بقوم حتى يغيروا ما بأنفسهم.", "إن الله مع الصابرين.", "من توكل على الله فهو حسبه.", "اذكروني أذكركم.", "الصلاة نور.", "الحياء من الإيمان.", "الطهور شطر الإيمان.", "إنما الأعمال بالنيات.", "الكلمة الطيبة صدقة.", "تبسمك في وجه أخيك صدقة.", "اتق الله حيثما كنت.", "خيركم من تعلم القرآن وعلمه.", "الدين النصيحة.", "لا يؤمن أحدكم حتى يحب لأخيه ما يحب لنفسه.", "المسلم من سلم الناس من لسانه ويده.", "أكمل المؤمنين إيماناً أحسنهم خلقاً.", "إن الله جميل يحب الجمال.", "اللهم إني أسألك علماً نافعاً.", "من سلك طريقاً يلتمس فيه علماً سهل الله له طريقاً إلى الجنة.", "طلب العلم فريضة على كل مسلم.", "خير الناس أنفعهم للناس.", "الدنيا سجن المؤمن وجنة الكافر.", "أعقلها وتوكل.", "إنما يحفظ الله من حفظه.", "من عظم شعائر الله فإنها من تقوى القلوب.", "وقل رب زدني علماً.", "وما توفيقي إلا بالله.", "إن مع العسر يسراً.", "فpاصبر إن وعد الله حق.", "الله لا يضيع أجر المحسنين." ], // علوم ومعرفة (35 حقيقة) science: [ "الضوء يستغرق 8 دقائق و20 ثانية للوصول من الشمس إلى الأرض.", "يحتوي جسم الإنسان على ما يكفي من الحديد لصنع مسمار طوله 7.5 سم.", "قلب الإنسان ينبض حوالي 100 ألف مرة في اليوم.", "الحوت الأزرق هو أكبر حيوان عاش على الأرض، حيث يصل وزنه إلى 200 طن.", "العسل هو الطعام الوحيد الذي لا يفسد.", "الذبابة ترفرف بجناحيها حوالي 200 مرة في الثانية.", "الفراشة تتذوق الطعام بأقدامها.", "الفيل هو الحيوان الوحيد الذي لا يستطيع القفز.", "السلحفاة يمكنها العيش لمدة تصل إلى 150 سنة.", "الكركم من أقوى المضادات الطبيعية للالتهابات.", "الليمون يحتوي على فيتامين C أكثر من البرتقال.", "التمر لا يحتوي على أي كوليسترول.", "الزنجبيل يساعد في تخفيف آلام المفاصل.", "العسل يعالج السعال أفضل من بعض الأدوية.", "القراءة لمدة 6 دقائق تخفض التوتر بنسبة 68٪.", "المشي يومياً يقلل خطر الإصابة بأمراض القلب.", "النوم الكافي يقوي الذاكرة.", "شرب الماء الدافئ مع الليمون في الصباح ينقي الجسم.", "الضحك يخفف الألم ويقوي المناعة.", "التأمل يحسن التركيز ويقلل القلق.", "الكتابة باليد تنشط الدماغ أكثر من الكتابة على الكمبيوتر.", "اللون الأزرق يقلل الشهية.", "الموز يحتوي على مادة تحسن المزاج.", "الشوكولاتة الداكنة تقوي الذاكرة.", "التوت يحسن النظر.", "السبانخ تزيد قوة العضلات.", "الثوم يقوي جهاز المناعة.", "الجزر يقوي النظر.", "الأسماك تزيد الذكاء.", "المكسرات تقوي الذاكرة.", "الزيتون يخفض الكوليسترول.", "الرمان ينقي الدم.", "الخيار يرطب الجسم.", "البطيخ يحتوي على 92٪ ماء.", "الأناناس يساعد على الهضم." ], // ردود عامة (40 رداً) general: [ "حيا بك! أسعد الله أوقاتك بكل خير.", "أهلاً وسهلاً، كيف يمكنني مساعدتك اليوم؟", "سعيد جداً بتواصلك معي، أنا حور العين جاهز للرد على استفساراتك.", "أتمنى أن تكون في أفضل حال، كيف يمكنني إسعادك اليوم؟", "الحمد لله أنا بخير، شكراً لسؤالك. وأنت كيف حالك؟", "شكراً لك على هذه الكلمات الطيبة، أنا أيضاً سعيد بالحديث معك.", "لا شكر على واجب، أنا هنا لخدمتك ومساعدتك.", "أهلاً بعودتك، لقد افتقدتك! كيف كانت أمورك؟", "يومك سعيد بإذن الله، وأتمنى لك التوفيق في جميع أعمالك.", "الله يسعدك ويوفقك، شكراً على محادثتك الطيبة.", "مرحباً بعودتك! هل لديك جديد تود مشاركته؟", "أهلاً وسهلاً بك مجدداً، سررت برؤيتك.", "كيف حال قلبك اليوم؟ أتمنى أن يكون مليئاً بالسعادة.", "الحمد لله على سلامتك، فرحت لرؤيتك.", "أتمنى أن يكون يومك جميلاً كما تخيلت.", "سعيد بسماع صوتك، كيف أمورك؟", "مرحباً بك في أي وقت، أنا هنا لأجلك.", "أهلاً بطل الود والكرم، كيف حالك؟", "سررت بتواصلك، هل هناك شيء معين تود الحديث عنه؟", "مرحباً بك في عالم الحور العين، مكانك معنا.", "أهلاً وسهلاً بك بين إخوانك.", "الحمد لله على اللقاء، كيف تقضي يومك؟", "مرحباً بعبق الورد، كيف حال الورد؟", "أهلاً بمن أشرقت الدنيا بقدومه.", "سررت بلقائك، هل تود أن نخوض في حديث ممتع؟", "مرحباً بك يا صديقي، كيف حالك اليوم؟", "أهلاً وسهلاً بك في أي وقت تشاء.", "الحمد لله على السلامة، كيف الحال؟", "مرحباً بك بعد الغياب، اشتقنا لحديثك.", "أهلاً بمن يجلب السعادة معه.", "سررت برؤيتك، هل جربت شيئاً جديداً اليوم؟", "مرحباً بك في حديثنا اليومي.", "أهلاً وسهلاً بك يا قرة العين.", "الحمد لله على اللقاء، هل لديك قصة ترويها؟", "مرحباً بك بعد الفراق، كيف كنت؟", "أهلاً بمن يضيء المكان بحضوره.", "سررت بلقائك، هل تريد أن نبدأ حديثاً جديداً؟", "مرحباً بك في حديقة الحديث.", "أهلاً وسهلاً بك بين الأحبة.", "الحمد لله على هذا اللقاء الطيب." ] }; // إحصائيات المحادثة let conversationStats = { userMessages: 0, botMessages: 1, // الرسالة الترحيبية الأولى wordsSent: 0, lastResponses: [], currentResponseType: 'all', isQuickActionsCollapsed: false, isResponseTypesCollapsed: false }; // تخزين التعليقات والتفاعلات let messageComments = {}; let messageReactions = {}; // تهيئة العناصر const chatMessages = document.getElementById('chatMessages'); const messageInput = document.getElementById('messageInput'); const quickActions = document.getElementById('quickActions'); const quickActionsHeader = document.getElementById('quickActionsHeader'); const responseTypes = document.getElementById('responseTypes'); const responseTypesHeader = document.getElementById('responseTypesTitle'); // تم التصحيح هنا const responseTypesContainer = document.getElementById('responseTypesContainer'); const commentModal = document.getElementById('commentModal'); const emojisContainer = document.getElementById('emojisContainer'); const commentsList = document.getElementById('commentsList'); const modalMessageContent = document.getElementById('modalMessageContent'); const commentInput = document.getElementById('commentInput'); let currentMessageElement = null; let currentMessageId = null; // تهيئة الرموز التعبيرية const emojis = ['😀', '😃', '😄', '😁', '😆', '😅', '😂', '🤣', '😊', '😇', '🙂', '🙃', '😉', '😌', '😍', '🥰', '😘', '😗', '😙', '😚', '😋', '😛', '😝', '😜', '🤪', '🤨', '🧐', '🤓', '😎', '🤩', '🥳', '😏', '😒', '😞', '😔', '😟', '😕', '🙁', '☹️', '😣', '😖', '😫', '😩', '🥺', '😢', '😭', '😤', '😠', '😡', '🤬', '🤯', '😳', '🥵', '🥶', '😱', '😨', '😰', '😥', '😓', '🤗', '🤔', '🤭', '🤫', '🤥', '😶', '😐', '😑', '😬', '🙄', '😯', '😦', '😧', '😮', '😲', '🥱', '😴', '🤤', '😪', '😵', '🤐', '🥴', '🤢', '🤮', '🤧', '😷', '🤒', '🤕', '🤑', '🤠', '😈', '👿', '👹', '👺', '🤡', '💩', '👻', '💀', '☠️', '👽', '👾', '🤖', '🎃', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', '😿', '😾', '🤲', '👐', '🙌', '👏', '🤝', '👍', '👎', '👊', '✊', '🤛', '🤜', '🤞', '✌️', '', '', '👌', '👈', '👉', '👆', '👇', '☝️', '✋', '🤚', '🖐', '🖖', '👋', '🤙', '💪', '', '✍️', '', '💍', '💄', '', '', '👅', '👂', '👃', '👣', '👁', '👀', '🧠', '🗣', '👤', '👥', '👶', '👧', '🧒', '👦', '👩', '🧑', '👨', '👩‍🦱', '🧑‍🦱', '👨‍🦱', '👩‍🦰', '🧑‍🦰', '👨‍🦰', '👱‍♀️', '👱', '👱‍♂️', '👩‍🦳', '🧑‍🦳', '👨‍🦳', '👩‍🦲', '🧑‍🦲', '👨‍🦲', '🧔', '👵', '🧓', '👴', '👲', '👳‍♀️', '👳', '👳‍♂️', '🧕', '👮‍♀️', '👮', '👮‍♂️', '👷‍♀️', '👷', '👷‍♂️', '💂‍♀️', '💂', '💂‍♂️', '🕵️‍♀️', '🕵️', '🕵️‍♂️', '👩‍⚕️', '🧑‍⚕️', '👨‍⚕️', '👩‍🌾', '🧑‍🌾', '👨‍🌾', '👩‍🍳', '🧑‍🍳', '👨‍🍳', '👩‍🎓', '🧑‍🎓', '👨‍🎓', '👩‍🎤', '🧑‍🎤', '👨‍🎤', '👩‍🏫', '🧑‍🏫', '👨‍🏫', '👩‍🏭', '🧑‍🏭', '👨‍🏭', '👩‍💻', '🧑‍💻', '👨‍💻', '👩‍💼', '🧑‍💼', '👨‍💼', '👩‍🔧', '🧑‍🔧', '👨‍🔧', '👩‍🔬', '🧑‍🔬', '👨‍🔬', '👩‍🎨', '🧑‍🎨', '👨‍🎨', '👩‍🚒', '🧑‍🚒', '👨‍🚒', '👩‍✈️', '🧑‍✈️', '👨‍✈️', '👩‍🚀', '🧑‍🚀', '👨‍🚀', '👩‍⚖️', '🧑‍⚖️', '👨‍⚖️', '👰', '🧑‍🍼', '👨‍🍼', '🤰', '🤱', '👩‍🍼', '🧑‍🍼', '👨‍🍼', '🧚‍♀️', '🧚', '🧚‍♂️', '🧜‍♀️', '🧜', '🧜‍♂️', '🧝‍♀️', '🧝', '🧝‍♂️', '🧞‍♀️', '🧞', '🧞‍♂️', '🧟‍♀️', '🧟', '🧟‍♂️', '💆‍♀️', '💆', '💆‍♂️', '💇‍♀️', '💇', '💇‍♂️', '🚶‍♀️', '🚶', '🚶‍♂️', '🏃‍♀️', '🏃', '🏃‍♂️', '', '🕺', '🕴', '👯‍♀️', '👯', '👯‍♂️', '🧖‍♀️', '🧖', '🧖‍♂️', '🧘‍♀️', '', '🧘‍♂️', '🛀', '🛌', '🧑‍🤝‍🧑', '👭', '👫', '👬', '', '', '', '🗣️', '👤', '👥', '🫂', '👣', '🧳', '🌂', '☂️', '🎃', '🧵', '🧶', '👓', '🕶', '🥽', '🥼', '🦺', '👔', '👕', '👖', '🧣', '🧤', '🧥', '🧦', '👗', '👘', '🥻', '🩱', '🩲', '🩳', '', '👚', '👛', '👜', '👝', '🎒', '👞', '👟', '🥾', '🥿', '', '👡', '🩰', '👢', '👑', '👒', '🎩', '🎓', '🧢', '', '📿', '💄', '💍', '💎']; // ملء الرموز التعبيرية في النافذة المنبثقة function populateEmojis() { emojisContainer.innerHTML = ''; emojis.forEach(emoji => { const emojiBtn = document.createElement('button'); emojiBtn.className = 'emoji-btn'; emojiBtn.textContent = emoji; emojiBtn.onclick = () => { commentInput.value += emoji; }; emojisContainer.appendChild(emojiBtn); }); } // دالة لتصدير المحادثة كـ JSON function exportChatToJSON() { if (currentChat.length === 0) { alert('لا توجد محادثة لتصديرها!'); return; } const chatData = { metadata: { title: "محادثة شات الحور", date: new Date().toISOString(), messageCount: currentChat.length, userMessages: conversationStats.userMessages, botMessages: conversationStats.botMessages }, messages: currentChat }; const jsonContent = JSON.stringify(chatData, null, 2); const blob = new Blob([jsonContent], { type: 'application/json;charset=utf-8' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `شات_الحور${new Date().toISOString().slice(0,10)}.json`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); addMessage('📊 تم تصدير المحادثة كملف JSON', 'bot'); } // تبديل طي/فرد الأزرار السريعة quickActionsHeader.addEventListener('click', function() { conversationStats.isQuickActionsCollapsed = !conversationStats.isQuickActionsCollapsed; if (conversationStats.isQuickActionsCollapsed) { quickActions.classList.add('collapsed'); quickActionsHeader.classList.add('collapsed'); } else { quickActions.classList.remove('collapsed'); quickActionsHeader.classList.remove('collapsed'); } }); // دالة لنسخ المحادثة إلى الحافظة function copyChatToClipboard() { if (currentChat.length === 0) { alert('لا توجد محادثة لنسخها!'); return; } let chatText = "محادثة شات الحور\n\n"; currentChat.forEach(msg => { chatText += `[${msg.time}] ${msg.sender === 'user' ? 'أنت' : 'شات الحور'}: ${msg.text}\n`; }); navigator.clipboard.writeText(chatText) .then(() => { addMessage('📋 تم نسخ المحادثة إلى الحافظة!', 'bot'); }) .catch(err => { alert('خطأ في النسخ: ' + err); }); } // دالة لطباعة المحادثة function printChat() { const printWindow = window.open('', '_blank'); printWindow.document.write(`

محادثة شات الحور

التاريخ: ${new Date().toLocaleDateString('ar-SA')}


`); currentChat.forEach(msg => { printWindow.document.write(`
${msg.sender === 'user' ? 'أنت' : 'شات الحور'}:

${msg.text}

${msg.time}
`); }); printWindow.document.write(`

تم الإنشاء بواسطة شات الحور - 00967770249963

`); // ==================== نظام المراسلة على الشبكة المحلية ==================== printWindow.document.close(); printWindow.print(); } // تبديل طي/فرد قسم أنواع الردود // ==================== قسم الطي/الفرد للردود والإحصائيات ==================== // 1. انتظر حتى يتم تحميل الصفحة بالكامل document.addEventListener('DOMContentLoaded', function() { // 2. عرّف العناصر const responseTypesHeader = document.getElementById('responseTypesTitle'); const responseTypesContainer = document.getElementById('responseTypesContainer'); // 3. تحقق من وجود العناصر if (!responseTypesHeader || !responseTypesContainer) { console.error("❌ عناصر قسم الردود غير موجودة"); return; } console.log("✅ تم العثور على عناصر قسم الردود والإحصائيات"); // 4. دالة الطي/الفرد function toggleResponseTypes() { console.log("🖱️ تم النقر على قسم الردود والإحصائيات"); // تحقق إذا كان مطوياً const isCollapsed = responseTypesContainer.classList.contains('collapsed'); if (isCollapsed) { // فتح القسم responseTypesContainer.classList.remove('collapsed'); responseTypesHeader.classList.remove('collapsed'); // تحديث الأيقونة const icon = responseTypesHeader.querySelector('i'); if (icon) { icon.style.transform = 'rotate(0deg)'; } console.log("📖 تم فتح قسم الردود والإحصائيات"); } else { // طي القسم responseTypesContainer.classList.add('collapsed'); responseTypesHeader.classList.add('collapsed'); // تحديث الأيقونة const icon = responseTypesHeader.querySelector('i'); if (icon) { icon.style.transform = 'rotate(-90deg)'; } console.log("📕 تم طي قسم الردود والإحصائيات"); } // حفظ الحالة في (اختياري) try { localStorage.setItem('responseTypesCollapsed', !isCollapsed); } catch (e) { console.warn("⚠️ تعذر حفظ الحالة"); } } // 5. تحميل الحالة المحفوظة (إذا كانت مطوية مسبقاً) try { const savedState = localStorage.getItem('responseTypesCollapsed'); if (savedState === 'true') { responseTypesContainer.classList.add('collapsed'); responseTypesHeader.classList.add('collapsed'); const icon = responseTypesHeader.querySelector('i'); if (icon) { icon.style.transform = 'rotate(-90deg)'; } console.log("📕 قسم الردود مطوي افتراضيًا"); } } catch (e) { console.warn("⚠️ تعذر تحميل الحالة المحفوظة"); } // 6. أضف حدث النقر responseTypesHeader.addEventListener('click', toggleResponseTypes); // 7. (اختياري) إزالة onclick من HTML إذا كان موجوداً responseTypesHeader.removeAttribute('onclick'); // 8. (اختياري) إضافة زر في واجهة المستخدم للتحكم addToggleButton(); }); // 9. دالة لإضافة زر تحكم في الواجهة (اختياري) function addToggleButton() { const chatContainer = document.querySelector('.chat-container'); if (!chatContainer) return; const toggleBtn = document.createElement('button'); toggleBtn.innerHTML = '📊 طي/فتح الإحصائيات'; toggleBtn.style.cssText = ` position: absolute; top: 10px; right: 10px; background: #4CAF50; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 12px; z-index: 1000; `; toggleBtn.onclick = function() { const header = document.getElementById('responseTypesTitle'); if (header) header.click(); }; chatContainer.style.position = 'relative'; chatContainer.appendChild(toggleBtn); } // ==================== أكمل بقية الكود هنا ==================== function addMessage (text, sender) { const messageId = Date.now() + Math.random(); const div = document.createElement('div'); div.className = `message ${sender}-message`; div.dataset.messageId = messageId; const time = new Date().toLocaleTimeString('ar-SA', { hour: '2-digit', minute: '2-digit', hour12: true }); // أضف هذا السطر في نهاية دالة addMessage الأصلية (بعد chatMessages trackMessage(text, sender, time); autoSaveIfNeeded(); div.innerHTML = ` ${text}
${time}
`; chatMessages.appendChild(div); chatMessages.scrollTop = chatMessages.scrollHeight; // تهيئة تخزين التعليقات والتفاعلات لهذه الرسالة messageComments[messageId] = []; messageReactions[messageId] = {}; // تحديث الإحصائيات if (sender === 'user') { conversationStats.userMessages++; conversationStats.wordsSent += text.split(' ').length; } else { conversationStats.botMessages++; } updateStats(); return div; } // تحديث الإحصائيات function updateStats() { document.getElementById('userMsgCount').textContent = conversationStats.userMessages; document.getElementById('botMsgCount').textContent = conversationStats.botMessages; document.getElementById('wordCount').textContent = conversationStats.wordsSent; } // الحصول على رد ذكي من أكثر من 30000 رد function getSmartResponse(userMessage) { function getSmartResponse(userMessage) { const message = userMessage.toLowerCase(); let responseType = 'general'; // === أضف هذا الكود في بداية الدالة === // معالجة طلبات القرآن أولاً if (window.QuranHelper) { const quranResponse = window.QuranHelper.handleQuranRequest(userMessage); if (quranResponse) { return quranResponse; } } // === نهاية الإضافة === // المنطق القديم يبقى كما هو if (message.includes('قصة') || message.includes('قصص') || message.includes('يحكى')) { responseType = 'story'; } else if (message.includes('نكت') || message.includes('نكتة') || message.includes('مزح')) { responseType = 'joke'; } else if (message.includes('حكمة') || message.includes('مثل') || message.includes('حكم')) { responseType = 'moral'; } else if (message.includes('شعر') || message.includes('قصيدة') || message.includes('أدب')) { responseType = 'poem'; } else if (message.includes('معلومة') || message.includes('حقائق') || message.includes('معلومات')) { responseType = 'science'; } else if (message.includes('نصيحة') || message.includes('نصائح') || message.includes('إرشاد')) { responseType = 'advice'; } // ... باقي الدالة كما هي } // تحليل الرسالة لتحديد النوع المناسب let responseType = 'general'; const message = userMessage.toLowerCase(); if (message.includes('قصة') || message.includes('يحكى') || message.includes('قصص') || message.includes('رواية')) { responseType = 'story'; } else if (message.includes('نكت') || message.includes('نكتة') || message.includes('زبج') || message.includes('مضحك')) { responseType = 'joke'; } else if (message.includes('أخلاق') || message.includes('خلق') || message.includes('حكمة') || message.includes('خلقي')) { responseType = 'moral'; } else if (message.includes('نصيحة') || message.includes('نصائح') || message.includes('إرشاد') || message.includes('ارشاد')) { responseType = 'advice'; } else if (message.includes('شعر') || message.includes('قصيدة') || message.includes('أدب') || message.includes('بيت')) { responseType = 'poem'; } else if (message.includes('إسلام') || message.includes('دين') || message.includes('قرآن') || message.includes('حديث')) { responseType = 'islamic'; } else if (message.includes('علم') || message.includes('معلومة') || message.includes('حقائق') || message.includes('معلومات')) { responseType = 'science'; } else if (message.includes('مرحبا') || message.includes('أهلا') || message.includes('سلام') || message.includes('السلام')) { responseType = 'general'; } // إذا كان النوع محدد في الواجهة if (conversationStats.currentResponseType !== 'all') { responseType = conversationStats.currentResponseType; } // تجنب تكرار الردود const availableResponses = responseDatabase[responseType].filter( response => !conversationStats.lastResponses.includes(response) ); // إذا استنفذنا جميع الردود، نعيد استخدام القائمة if (availableResponses.length === 0) { conversationStats.lastResponses = []; return responseDatabase[responseType][0]; } // اختيار رد عشوائي const randomIndex = Math.floor(Math.random() * availableResponses.length); const selectedResponse = availableResponses[randomIndex]; // حفظ الرد الأخير لتجنب التكرار conversationStats.lastResponses.push(selectedResponse); if (conversationStats.lastResponses.length > 15) { conversationStats.lastResponses.shift(); } return selectedResponse; } // إرسال رسالة function sendMessage() { const text = messageInput.value.trim(); if (!text) return; addMessage(text, 'user'); messageInput.value = ''; // محاكاة تفكير الحور العين setTimeout(() => { const response = getSmartResponse(text); addMessage(response, 'bot'); // أحياناً نضيف ر// إضافة ردود جديدة إلى قاعدة البيانات الحالية function addMoreResponses() { // أخلاق وحكمة - إضافة 300 رد جديد const moreMorals = [ "العدل في المبادئ يلتزم بها بصلابة.", "الإنصاف في المثل العليا يسعى إليها باجتهاد.", "العدل في الأهداف يضعها بواقعية.", "الإنصاف في الطموحات يطمح بمعقولية.", "العدل في الأحلام يحلم بإيجابية.", "الإنصاف في التخطيط يخطط بعناية.", "العدل في التنفيذ ينفذ بدقة.", "الإنصاف في المتابعة يتابع باهتمام.", "العدل في التقييم يقيم بموضوعية.", "الإنصاف في التطوير يطور باستمرار.", "العدل في التحديث يحدث بانتظام.", "الإنصاف في التجديد يجدد بإبداع.", "العدل في الإصلاح يصلح بجدية.", "الإنصاف في التطوير يطور بذكاء.", "العدل في النمو ينمو بتوازن.", "الإنصاف في التقدم يتقدم بثبات.", "العدل في الرقي يرتقي بانسجام.", "الإنصاف في الازدهار يزدهر بتناغم.", "العدل في السعادة يسعد بتوازن.", "الإنصاف في الرضا يرضى بقناعة.", "العدل في الطمأنينة يطمئن بثقة.", "الإنصاف في الأمان يأمن باطمئنان.", "العدل في السلام يسلم بأمان.", "الإنصاف في المحبة يحب بصدق.", "العدل في الأخوة يعامل الإخوة بعدل.", "الإنصاف في الصداقة يعامل الأصدقاء بإنصاف.", "العدل في العلاقات يحافظ عليها بتوازن.", "الإنصاف في التعامل يتعامل مع الجميع بإنصاف.", "العدل في المعاملة يعامل الناس بعدل.", "الإنصاف في الكلام يتكلم بإنصاف.", "العدل في السكوت يسكت بحكمة.", "الإنصاف في الاستماع يستمع بانتباه.", "العدل في الفهم يفهم بعمق.", "الإنصاف في التحليل يحلل بموضوعية.", "العدل في الاستنتاج يستنتج بدقة.", "الإنصاف في الحكم يحكم بعدل.", "العدل في القرار يتخذ القرار بحكمة.", "الإنصاف في التنفيذ ينفذ القرار بدقة.", "العدل في المتابعة يتابع التنفيذ باهتمام.", "الإنصاف في التقييم يقيم النتائج بموضوعية.", "العدل في التحسين يحسن الأداء باستمرار.", "الإنصاف في التطوير يطور النتائج بذكاء.", "العدل في الإنجاز ينجز المهام بكفاءة.", "الإنصاف في النجاح ينجح باجتهاد.", "العدل في التميز يتميز بتفوق.", "الإنصاف في الإبداع يبدع ببراعة.", "العدل في الابتكار يبتكر بذكاء.", "الإنصاف في الاختراع يخترع بإبداع.", "العدل في الاكتشاف يكتشف بعبقرية.", "الإنصاف في البحث يبحث باجتهاد.", "العدل في الدراسة يدرس بعناية.", "الإنصاف في التعليم يعلم بصدق.", "العدل في التدريب يدرب بكفاءة.", "الإنصاف في التوجيه يوجه بحكمة.", "الإنصاف في الإرشاد يرشد بخبرة." ]; // دمج الردود الجديدة مع القديمة responseDatabase.moral = [...responseDatabase.moral, ...moreMorals]; } // دالة لإضافة أسئلة جديدة بسهولة function addNewQuestions(category, newQuestions) { if (IslamicCompetition.questionLibrary[category]) { IslamicCompetition.questionLibrary[category].questions.push(...newQuestions); console.log(`تم إضافة ${newQuestions.length} سؤال جديد إلى ${category}`); return true; } return false; } // مثال على إضافة أسئلة جديدة: const newQuranQuestions = [ { id: "q6", question: "كم مرة ذكرت كلمة 'الله' في القرآن الكريم؟", options: ["2679", "2816", "2950", "3100"], correct: 0, explanation: "ذكرت كلمة 'الله' في القرآن 2679 مرة", points: 25, category: "أسئلة متقدمة" }, { id: "q7", question: "ما هي السورة التي لم تبدأ بالبسملة؟", options: ["الفاتحة", "التوبة", "الكوثر", "الناس"], correct: 1, explanation: "سورة التوبة هي السورة الوحيدة التي لم تبدأ بالبسملة", points: 20, category: "معلومات عامة" } ]; // استدعاء الدالة لإضافة الأسئلة الجديدة addNewQuestions('quran', newQuranQuestions); // دالة لإنشاء مسابقة جديدة كاملة function createNewQuiz(quizData) { IslamicCompetition.questionLibrary[quizData.id] = { title: quizData.title, icon: quizData.icon, description: quizData.description, difficulty: quizData.difficulty, timePerQuestion: quizData.timePerQuestion || 30, questions: quizData.questions }; console.log(`تم إنشاء مسابقة جديدة: ${quizData.title}`); } // مثال على إنشاء مسابقة جديدة: const newQuiz = { id: "prophets", title: "الأنبياء والرسل", icon: "🌟", description: "أسئلة عن أنبياء الله ورسله", difficulty: "متوسط", timePerQuestion: 25, questions: [ { id: "p1", question: "كم عدد الأنبياء والرسل الذين ذكروا في القرآن؟", options: ["20", "25", "30", "35"], correct: 1, explanation: "ذكر في القرآن 25 نبياً ورسولاً", points: 15, category: "معلومات عامة" }, { id: "p2", question: "من هو أول الأنبياء؟", options: ["آدم عليه السلام", "نوح عليه السلام", "إبراهيم عليه السلام", "موسى عليه السلام"], correct: 0, explanation: "آدم عليه السلام هو أول الأنبياء وأبو البشر", points: 10, category: "معلومات أساسية" } ] }; createNewQuiz(newQuiz); // استدعاء الدالة لإضافة الردود الإضافية addMoreResponses(); if (Math.random() > 3.7) { setTimeout(() => { const followUps = [ "من انت الو به احد بيسمعني الموضوع؟", " اذكر الله يا صديقي وبانكمل مجبر؟", " معك أي سؤال ؟", "أتمنى أن ردي واضح وتستفيد .", "فرحتني حن اقدرت اساعدك في هذا الموضوع.", "عادك تشتي أن نناقش موضوع غيرة؟", "كيف بعد مجبري؟", "هيا كن بكر بدري قد اخبر .", "يه حاجه محددة تشتي تعرفها أكثر؟", "أنا هانا الحيمي بكله وشحمه وللحمة اجاوبك على كل اسالتك الله يكتب الاجر ." ]; const followUp = followUps[Math.floor(Math.random() * followUps.length)]; addMessage(followUp, 'bot'); }, 1000); } }, 3500 + Math.random() * 4500+1500); // وقت رد عشوائي لمحاكاة البشر } // ==================== نظام تسجيل صوتي حقيقي ==================== // متغيرات التسجيل الصوتي let mediaRecorder = null; let audioChunks = []; let isRecording = false; let stream = null; let audioContext = null; let analyser = null; let microphone = null; let javascriptNode = null; let recordingTimeout = null; // عناصر DOM const voiceInput = document.getElementById('voiceInput'); const audioPlayer = document.getElementById('audioPlayer'); // دالة لطلب إذن الميكروفون async function requestMicrophonePermission() { try { // طلب إذن الوصول للميكروفون stream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true, sampleRate: 44100 } }); // تهيئة AudioContext audioContext = new (window.AudioContext || window.webkitAudioContext)(); analyser = audioContext.createAnalyser(); microphone = audioContext.createMediaStreamSource(stream); // توصيل الميكروفون بالتحليل microphone.connect(analyser); // إعداد التحليل لرسم الموجات الصوتية analyser.fftSize = 2048; const bufferLength = analyser.frequencyBinCount; const dataArray = new Uint8Array(bufferLength); console.log('✅ تم تفعيل الميكروفون بنجاح'); return true; } catch (error) { console.error('❌ خطأ في الوصول للميكروفون:', error); // رسائل خطأ بالعربية let errorMessage = '❌ لا يمكن الوصول إلى الميكروفون. '; if (error.name === 'NotAllowedError') { errorMessage += 'يجب منح الإذن لاستخدام الميكروفون.'; } else if (error.name === 'NotFoundError') { errorMessage += 'لم يتم العثور على ميكروفون.'; } else if (error.name === 'NotSupportedError') { errorMessage += 'المتصفح لا يدعم التسجيل الصوتي.'; } else { errorMessage += `خطأ: ${error.message}`; } addMessage(errorMessage, 'bot'); return false; } } // بدء التسجيل الصوتي async function startRecording() { try { // طلب إذن الميكروفون إذا لم يكن مفعل if (!stream) { const permissionGranted = await requestMicrophonePermission(); if (!permissionGranted) return false; } // إعادة إنشاء MediaRecorder في كل مرة mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/webm;codecs=opus', audioBitsPerSecond: 128000 }); // تهيئة المصفوفة لتخزين مقاطع الصوت audioChunks = []; // حدث عند استلام بيانات الصوت mediaRecorder.ondataavailable = (event) => { if (event.data.size > 0) { audioChunks.push(event.data); } }; // حدث عند إنهاء التسجيل mediaRecorder.onstop = () => { // إنشاء ملف صوتي من المقاطع const audioBlob = new Blob(audioChunks, { type: 'audio/webm;codecs=opus' }); // إنشاء رابط للصوت const audioUrl = URL.createObjectURL(audioBlob); // إرسال الرسالة الصوتية sendVoiceMessage(audioUrl, audioBlob); // إعادة تعيين المتغيرات isRecording = false; audioChunks = []; // تحديث واجهة المستخدم voiceInput.classList.remove('recording'); voiceInput.innerHTML = ''; voiceInput.title = 'سجل رسالة صوتية'; }; // بدء التسجيل mediaRecorder.start(100); // جمع البيانات كل 100 مللي ثانية isRecording = true; // تحديث واجهة المستخدم voiceInput.classList.add('recording'); voiceInput.innerHTML = ''; voiceInput.title = 'أوقف التسجيل'; // رسالة تأكيد console.log('🎤 بدأ التسجيل الصوتي'); // إضافة مؤقت للتسجيل التلقائي (30 ثانية كحد أقصى) recordingTimeout = setTimeout(() => { if (isRecording) { stopRecording(); addMessage('⏱️ تم إيقاف التسجيل تلقائياً بعد 30 ثانية.', 'bot'); } }, 30000); return true; } catch (error) { console.error('❌ خطأ في بدء التسجيل:', error); addMessage('❌ تعذر بدء التسجيل الصوتي. يرجى المحاولة مرة أخرى.', 'bot'); return false; } } // إيقاف التسجيل الصوتي function stopRecording() { if (!mediaRecorder || !isRecording) return; // إيقاف المؤقت if (recordingTimeout) { clearTimeout(recordingTimeout); recordingTimeout = null; } // إيقاف التسجيل mediaRecorder.stop(); console.log('⏹️ تم إيقاف التسجيل'); // إيقاف جميع المسارات الصوتية if (stream) { stream.getTracks().forEach(track => track.stop()); stream = null; } } // إرسال رسالة صوتية function sendVoiceMessage(audioUrl, audioBlob) { // إنشاء معرّف فريد للرسالة الصوتية const voiceId = 'voice_' + Date.now(); // إنشاء عنصر صوت const audioElement = `
المتصفح لا يدعم تشغيل الصوت.
`; // إضافة الرسالة الصوتية للشات const div = document.createElement('div'); div.className = 'user-message'; div.innerHTML = ` 🎤 رسالة صوتية
${new Date().toLocaleTimeString('ar-SA', { hour: '2-digit', minute: '2-digit' })}
${audioElement} `; chatMessages.appendChild(div); chatMessages.scrollTop = chatMessages.scrollHeight; // تحديث الإحصائيات conversationStats.userMessages++; updateStats(); // حفظ الرسالة الصوتية مؤقتاً saveVoiceMessageToStorage(voiceId, audioBlob); // إضافة رد تلقائي setTimeout(() => { const responses = [ "🎧 استمعت لرسالتك الصوتية! كيف يمكنني مساعدتك؟", "🔊 تلقيت رسالتك الصوتية. هل يمكنك إعادة صياغتها كتابياً إذا أردت؟", "🎤 شكراً للرسالة الصوتية! أنا هنا للإجابة على استفساراتك.", "👂 سمعت رسالتك. هل هناك شيء محدد تريد مناقشته؟", "💬 استمعت للصوت. هل يمكنني مساعدتك في شيء معين؟" ]; const response = responses[Math.floor(Math.random() * responses.length)]; addMessage(response, 'bot'); }, 1500); console.log('📤 تم إرسال الرسالة الصوتية'); } // حفظ الرسالة الصوتية في التخزين المؤقت function saveVoiceMessageToStorage(id, blob) { try { // تحويل blob إلى base64 للتخزين const reader = new FileReader(); reader.onloadend = function() { const base64data = reader.result; const voiceMessage = { id: id, data: base64data, timestamp: new Date().toISOString(), type: 'audio/webm' }; // حفظ في localStorage const savedVoices = JSON.parse(localStorage.getItem('voiceMessages') || '[]'); savedVoices.push(voiceMessage); // الاحتفاظ بآخر 20 رسالة صوتية فقط if (savedVoices.length > 20) { savedVoices.shift(); } localStorage.setItem('voiceMessages', JSON.stringify(savedVoices)); console.log('💾 تم حفظ الرسالة الصوتية'); }; reader.readAsDataURL(blob); } catch (error) { console.error('❌ خطأ في حفظ الرسالة الصوتية:', error); } } // تنزيل الرسالة الصوتية function downloadVoiceMessage(id, url) { const a = document.createElement('a'); a.href = url; a.download = `رسالة_صوتية_${new Date().toLocaleDateString('ar-SA').replace(/\//g, '-')}.webm`; a.click(); addMessage('📥 تم بدء تنزيل الرسالة الصوتية.', 'bot'); } // حذف الرسالة الصوتية function deleteVoiceMessage(id) { const voiceElement = document.getElementById(id); if (voiceElement && confirm('هل تريد حذف هذه الرسالة الصوتية؟')) { voiceElement.closest('.message').remove(); // حذف من localStorage const savedVoices = JSON.parse(localStorage.getItem('voiceMessages') || '[]'); const updatedVoices = savedVoices.filter(voice => voice.id !== id); localStorage.setItem('voiceMessages', JSON.stringify(updatedVoices)); addMessage('🗑️ تم حذف الرسالة الصوتية.', 'bot'); } } // تشغيل كل الرسائل الصوتية تلقائياً function playAllVoiceMessages() { const audioElements = document.querySelectorAll('audio'); audioElements.forEach(audio => { audio.play().catch(e => console.log('تعذر تشغيل الصوت:', e)); }); } // حدث النقر على زر الميكروفون voiceInput.addEventListener('click', async function() { if (!isRecording) { // بدء التسجيل const started = await startRecording(); if (started) { addMessage('🎤 جاري التسجيل... تحدث الآن.', 'bot'); } } else { // إيقاف التسجيل stopRecording(); addMessage('⏹️ تم إوقف التسجيل.', 'bot'); } }); // إضافة ردود فعل للتسجيل voiceInput.addEventListener('mouseenter', function() { if (!isRecording) { this.style.transform = 'scale(1.1)'; } }); voiceInput.addEventListener('mouseleave', function() { if (!isRecording) { this.style.transform = 'scale(1)'; } }); // الكشف عن المتصفحات التي تدعم التسجيل الصوتي function checkRecordingSupport() { if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { addMessage('⚠️ المتصفح لا يدعم التسجيل الصوتي. حاول استخدام Chrome أو Edge.', 'bot'); voiceInput.style.display = 'none'; return false; } if (!MediaRecorder) { addMessage('⚠️ إصدار المتصفح قديم. يرجى التحديث لأحدث نسخة.', 'bot'); voiceInput.style.display = 'none'; return false; } return true; } // تحميل الرسائل الصوتية المحفوظة عند بدء التشغيل function loadSavedVoiceMessages() { try { const savedVoices = JSON.parse(localStorage.getItem('voiceMessages') || '[]'); if (savedVoices.length > 0) { console.log(`📂 تم تحميل ${savedVoices.length} رسالة صوتية محفوظة`); // إضافة رسالة توضيحية setTimeout(() => { addMessage(`🎵 لدي ${savedVoices.length} رسالة صوتية محفوظة من جلسات سابقة.`, 'bot'); }, 3000); } } catch (error) { console.error('❌ خطأ في تحميل الرسائل الصوتية:', error); } } // تهيئة نظام التسجيل عند تحميل الصفحة window.addEventListener('load', function() { // التحقق من دعم المتصفح const isSupported = checkRecordingSupport(); if (isSupported) { // تحميل الرسائل الصوتية المحفوظة loadSavedVoiceMessages(); // إضافة رسالة ترحيب setTimeout(() => { addMessage('🎤 يمكنك الآن استخدام زر الميكروفوم لتسجيل رسائل صوتية حقيقية!', 'bot'); }, 5000); } }); // ==================== نهاية نظام التسجيل الصوتي الحقيقي ==================== // أزرار سريعة quickActions.addEventListener('click', function(e) { if (e.target.classList.contains('quick-btn')) { const text = e.target.getAttribute('data-text'); messageInput.value = text; sendMessage(); } }); // تغيير نوع الردود responseTypes.addEventListener('click', function(e) { if (e.target.classList.contains('type-btn')) { // إزالة النشاط من جميع الأزرار document.querySelectorAll('.type-btn').forEach(btn => { btn.classList.remove('active'); }); // إضافة النشاط للزر المضغوط e.target.classList.add('active'); // تحديث نوع الرد conversationStats.currentResponseType = e.target.getAttribute('data-type'); // إضافة رسالة توضيحية const typeNames = { 'all': 'جميع الردود', 'moral': 'الأخلاق والحكمة', 'story': 'القصص والعبر', 'joke': 'النكت والمرح', 'advice': 'النصائح والإرشادات', 'poem': 'الشعر والأدب', 'islamic': 'الإسلاميات', 'science': 'العلوم والمعرفة والدين' }; addMessage(`📂 تم تغيير نمط الردود إلى: ${typeNames[conversationStats.currentResponseType]}`, 'bot'); } }); // إرسال بالضغط على Enter messageInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { sendMessage(); } }); // رد الفعل على الرسالة function reactToMessage(button, emoji) { const messageElement = button.closest('.message'); const messageId = messageElement.dataset.messageId; if (!messageReactions[messageId]) { messageReactions[messageId] = {}; } if (!messageReactions[messageId][emoji]) { messageReactions[messageId][emoji] = 0; } messageReactions[messageId][emoji]++; // عرض ردود الفعل تحت الرسالة updateMessageReactions(messageElement, messageId); } // تحديث عرض ردود الفعل function updateMessageReactions(messageElement, messageId) { let reactionsContainer = messageElement.querySelector('.reactions-container'); if (!reactionsContainer) { reactionsContainer = document.createElement('div'); reactionsContainer.className = 'reactions-container'; messageElement.appendChild(reactionsContainer); } reactionsContainer.innerHTML = ''; if (messageReactions[messageId]) { Object.keys(messageReactions[messageId]).forEach(emoji => { if (messageReactions[messageId][emoji] > 0) { const reactionElement = document.createElement('div'); reactionElement.className = 'reaction'; reactionElement.innerHTML = ` ${emoji} ${messageReactions[messageId][emoji]} `; reactionsContainer.appendChild(reactionElement); } }); } } // فتح نافذة التعليقات function openCommentModal(button) { currentMessageElement = button.closest('.message'); currentMessageId = currentMessageElement.dataset.messageId; // عرض محتوى الرسالة في النافذة المنبثقة const messageText = currentMessageElement.innerHTML.split('
')[0]; modalMessageContent.innerHTML = `
${messageText}
`; // تحميل التعليقات loadComments(); // عرض النافذة المنبثقة commentModal.classList.add('active'); // تهيئة الرموز التعبيرية populateEmojis(); } // إغلاق النافذة المنبثقة function closeModal() { commentModal.classList.remove('active'); commentInput.value = ''; currentMessageElement = null; currentMessageId = null; } // تحميل التعليقات function loadComments() { commentsList.innerHTML = ''; if (!messageComments[currentMessageId] || messageComments[currentMessageId].length === 1000000) { commentsList.innerHTML = '

لا توجد تعليقات بعد

'; return; } messageComments[currentMessageId].forEach((comment, index) => { const commentElement = document.createElement('div'); commentElement.className = 'comment-item'; commentElement.innerHTML = `
${comment.author}
${comment.text}
أعجبني حذف
`; commentsList.appendChild(commentElement); }); } // إضافة تعليق function addComment() { const commentText = commentInput.value.trim(); if (!commentText || !currentMessageId) return; if (!messageComments[currentMessageId]) { messageComments[currentMessageId] = []; } const newComment = { author: 'أنت', text: commentText, timestamp: new Date().toISOString() }; messageComments[currentMessageId].push(newComment); commentInput.value = ''; loadComments(); // إضافة رد تلقائي من الحور العين أحياناً if (Math.random() > 0.1 && messageComments[currentMessageId].length === 1) { setTimeout(() => { const botResponses = [ "أذكرو اللة يذكركم ، وشكروة على نعمة يزدكم؟", "تعليق جميل! بس لو كان في ذكر لله كان أجمل؟", "أنا سعيد باهتمامك! هل تريد المزيد من المعلومات؟", "تعليقك يثلج الصدر! هل تشتي مناقشة تريح القلب؟", "شكراً لمشاركتك الضخمة! أنا هنا لذكرك بللةه انتبة ." ]; const botComment = { author: 'شات حور', text: botResponses[Math.floor(Math.random() * botResponses.length)], timestamp: new Date().toISOString() }; messageComments[currentMessageId].push(botComment); loadComments(); }, 100000000); } } // إعجاب بالتعليق function likeComment(commentIndex) { alert('تم تسجيل إعجابك بالتعليق!'); } // حذف تعليق function deleteComment(commentIndex) { if (confirm('هل تريد حذف هذا التعليق؟')) { messageComments[currentMessageId].splice(commentIndex, 1); loadComments(); } } // إغلاق النافذة المنبثقة بالضغط على ESC document.addEventListener('keydown', function(e) { if (e.key === 'Escape' && commentModal.classList.contains('active')) { closeModal(); } }); // إضافة بعض الرسائل المبدئية setTimeout(() => { addMessage("أتمنى أن تجد في محادثتي ما يفيدك ويسعدك دنياء وأخرة اتقي لله في استخدامك للشات. أنا هنا لأشاركك الحكمة والمعرفة بكل أخلاق من الكتاب والسنة والعترة المطهرة (انتضر الرسالة الثانية فيها كيف الاستخدام للشات.", 'bot'); }, 2000); setTimeout(() => { addMessage("تنبة! مهم اسحب من اسفل الشاشة الى الاعلا حتى يضهر لك منفذ الدردشه وتقدر تستخدم الأزرار السريعة أسفل الشات لبدء محادثات مختلفة ومتنوعة (يمكنك طيه او اخفائها عشان تقدر تكتب في منفذ الرسائل بالسهم الأعلى). أو تغيير نمط الردود من القائمة الجانبية.", 'bot'); }, 11000); // تحديث الإحصائيات أول مرة updateStats(); // ==================== نظام حفظ المحادثات في ملفات txt ==================== // متغير لتخزين المحادثة الحالية let currentChat = []; // دالة لحفظ الرسائل في المصفوفة function trackMessage(text, sender, time) { currentChat.push({ text: text.replace(/
/g, '\n').replace(/<[^>]*>/g, ''), sender: sender, time: time, timestamp: new Date().toISOString() }); // حفظ في localStorage أيضاً localStorage.setItem('chatBackup', JSON.stringify(currentChat)); } // تحديث دالة addMessage لتتبع الرسائل // ابحث عن دالة addMessage الأصلية وأضف هذا السطر في نهايتها: // trackMessage(text, sender, time); // دالة لحفظ المحادثة في ملف txt function saveChatToTxt() { if (currentChat.length === 0) { alert('لا توجد محادثة لحفظها!'); return; } let chatContent = "=== محادثة شات الحور ===\n"; chatContent += `التاريخ: ${new Date().toLocaleDateString('ar-SA')}\n`; chatContent += `الوقت: ${new Date().toLocaleTimeString('ar-SA')}\n`; chatContent += "=".repeat(40) + "\n\n"; currentChat.forEach((msg, index) => { const senderName = msg.sender === 'user' ? 'أنت' : 'شات الحور'; chatContent += `[${msg.time}] ${senderName}:\n`; chatContent += `${msg.text}\n`; chatContent += "-".repeat(30) + "\n"; }); chatContent += "\n" + "=".repeat(40) + "\n"; chatContent += "تم الإنشاء بواسطة شات الحور الذكي\n"; chatContent += "رقم المطور: 00967770249963\n"; // إنشاء ملف وتنزيله const blob = new Blob([chatContent], { type: 'text/plain;charset=utf-8' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `محادثة_شات_االحور_${new Date().toLocaleDateString('ar-SA').replace(/\//g, '-')}.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); // إضافة رسالة تأكيد addMessage(`💾 تم حفظ المحادثة في ملف نصي. يمكنك العثور عليه في مجلد التنزيلات باسم: ${a.download}`, 'bot'); } // دالة لتحميل محادثة من ملف function loadChatFromTxt() { const input = document.createElement('input'); input.type = 'file'; input.accept = '.txt'; input.onchange = function(event) { const file = event.target.files[0]; if (!file) return; const reader = new FileReader(); reader.onload = function(e) { try { const content = e.target.result; displayLoadedChat(content); } catch (error) { alert('حدث خطأ في قراءة الملف: ' + error.message); } }; reader.readAsText(file); }; input.click(); } // عرض المحادثة المحملة function displayLoadedChat(content) { // مسح المحادثة الحالية clearCurrentChat(); // إضافة رسالة تأكيد addMessage('📂 تم تحميل محادثة من ملف نصي. جاري عرضها...', 'bot'); // تقسيم المحتوى وعرضه const lines = content.split('\n'); let currentSender = ''; let currentText = ''; lines.forEach(line => { if (line.includes('أنت:')) { // حفظ الرسالة السابقة إذا كانت موجودة if (currentText && currentSender) { setTimeout(() => { addMessage(currentText, currentSender === 'أنت' ? 'user' : 'bot'); }, 500); } currentSender = 'أنت'; currentText = line.replace('أنت:', '').trim(); } else if (line.includes('شات العين:')) { if (currentText && currentSender) { setTimeout(() => { addMessage(currentText, currentSender === 'أنت' ? 'user' : 'bot'); }, 500); } currentSender = 'شات العين'; currentText = line.replace('شات الحور:', '').trim(); } else if (line.trim() && !line.includes('===') && !line.includes('---')) { currentText += '\n' + line.trim(); } }); // إضافة آخر رسالة if (currentText && currentSender) { setTimeout(() => { addMessage(currentText, currentSender === 'أنت' ? 'user' : 'bot'); }, 500); } setTimeout(() => { addMessage('✅ تم تحميل المحادثة بنجاح!', 'bot'); }, 1000); } // دالة لمسح المحادثة الحالية function clearCurrentChat() { if (confirm('هل تريد مسح المحادثة الحالية؟ سيتم حفظها أولاً تلقائياً.')) { // حفظ تلقائي قبل المسح saveChatToTxt(); // مسح العرض const chatMessages = document.getElementById('chatMessages'); chatMessages. innerHTML = ''; // إعادة إضافة الرسالة الترحيبية const welcomeMsg = ` السلام عليكم ورحمة الله وبركاته 🌹
أنا ادارة العين، أسعد بمحادثتك. كيف يمكنني مساعدتك اليوم؟
الآن
`; const div = document.createElement('div'); div.className = 'bot-message'; div.innerHTML = welcomeMsg; chatMessages.appendChild(div); // إعادة تعيين currentChat currentChat = []; localStorage.removeItem('chatBackup'); // تحديث الإحصائيات conversationStats.userMessages = 0; conversationStats.botMessages = 1; conversationStats.wordsSent = 0; updateStats(); } } // دالة لحفظ تلقائي كل 10 رسائل function autoSaveIfNeeded() { if (currentChat.length > 0 && currentChat.length % 10 === 0) { const autoSaveBtn = document.createElement('button'); autoSaveBtn.innerHTML = '💾 حفظ تلقائي'; autoSaveBtn.style.cssText = ` position: fixed; bottom: 100px; right: 20px; background: linear-gradient(to right, #4CAF50, #2E7D32); color: white; border: none; padding: 10px 15px; border-radius: 20px; cursor: pointer; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.2); font-size: 12px; `; autoSaveBtn.onclick = saveChatToTxt; document.body.appendChild(autoSaveBtn); setTimeout(() => { if (autoSaveBtn.parentNode) { autoSaveBtn.parentNode.removeChild(autoSaveBtn); } }, 5000); } } // تحميل النسخة الاحتياطية عند بدء التشغيل window.addEventListener('load', function() { const backup = localStorage.getItem('chatBackup'); if (backup) { const loadBackup = confirm('تم العثور على محادثة محفوظة. هل تريد استعادتها؟'); if (loadBackup) { try { currentChat = JSON.parse(backup); // عرض رسالة addMessage('📂 تم استعادة المحادثة المحفوظة!', 'bot'); } catch (e) { console.error('خطأ في تحميل النسخة الاحتياطية:', e); } } } }); // ==================== نظام المسابقات والجوائز والترقيات ==================== // competition-system.js // نظام المسابقات المتكامل window.competitionSystem = { // الحالة الحالية state: { isCompetitionOpen: false, currentQuiz: null, currentQuestion: 0, score: 0, coins: parseInt(localStorage.getItem('competition_coins')) || 3, medals: JSON.parse(localStorage.getItem('competition_medals')) || [], selectedAnswer: null, timer: null, timeLeft: 0, results: [], totalQuestions: 0, correctAnswers: 0, wrongAnswers: 0, skippedAnswers: 0 }, // مستويات الميداليات medalLevels: [ { threshold: 9, name: "حديد", icon: "🛡️", class: "medal-iron" }, { threshold: 18, name: "برونزي", icon: "🥉", class: "medal-bronze" }, { threshold: 27, name: "فضي", icon: "🥈", class: "medal-silver" }, { threshold: 36, name: "ذهبي", icon: "🥇", class: "medal-gold" }, { threshold: 45, name: "بلاتيني", icon: "🏆", class: "medal-platinum" }, { threshold: 54, name: "ماسي", icon: "💎", class: "medal-diamond" }, { threshold: 63, name: "الغازي", icon: "👑", class: "medal-conqueror" } ], // تهيئة النظام init: function() { console.log("🎯 نظام المسابقات جاهز!"); this.updateMedalDisplay(); }, // فتح نظام المسابقات openCompetitionSystem: function() { this.state.isCompetitionOpen = true; this.renderCompetitionModal(); }, // إغلاق نظام المسابقات closeCompetitionSystem: function() { this.state.isCompetitionOpen = false; this.closeModal(); }, // عرض نافذة المسابقة renderCompetitionModal: function() { const modal = document.createElement('div'); modal.className = 'modal-overlay competition-modal active'; modal.id = 'competitionModal'; modal.innerHTML = `

نظام المسابقات

${this.state.coins}
${this.getCurrentMedal().name}
`; document.body.appendChild(modal); this.renderCompetitionSelection(); this.addEventListeners(); }, // عرض قائمة المسابقات renderCompetitionSelection: function() { const container = document.getElementById('competitionSelection'); if (!container) return; let html = '

اختر نوع المسابقة

'; html += '
'; for (const [key, quiz] of Object.entries(window.questionsLibrary)) { html += `
${quiz.icon}

${quiz.title}

${quiz.description}

${quiz.timePerQuestion} ثانية/سؤال ${quiz.questions.length} سؤال
${quiz.difficulty}
بدء المسابقة
`; } // أزرار إضافية html += `
🏆

لوحة المتصدرين

شاهد أفضل اللاعبين

🎖️

ميدالياتي

عرض الميداليات المكتسبة

`; html += '
'; container.innerHTML = html; // إضافة أحداث للأزرار document.querySelectorAll('.start-quiz-btn').forEach(btn => { btn.addEventListener('click', (e) => { e.stopPropagation(); const quizType = btn.dataset.quiz; this.startQuiz(quizType); }); }); document.getElementById('showLeaderboard')?.addEventListener('click', () => this.showLeaderboard()); document.getElementById('showMedals')?.addEventListener('click', () => this.showMedals()); }, // بدء المسابقة startQuiz: function(quizType) { if (this.state.coins < 3) { this.showMessage('تحتاج إلى 3 عملات ذهبية على الأقل للمشاركة!', 'error'); return; } this.state.currentQuiz = window.questionsLibrary[quizType]; this.state.currentQuestion = 0; this.state.score = 0; this.state.selectedAnswer = null; this.state.results = []; this.state.totalQuestions = this.state.currentQuiz.questions.length; this.state.correctAnswers = 0; this.state.wrongAnswers = 0; this.state.skippedAnswers = 0; // خصم 3 عملات للمشاركة this.state.coins -= 3; this.saveState(); this.showQuestion(); }, // عرض السؤال showQuestion: function() { document.getElementById('competitionSelection').style.display = 'none'; document.getElementById('questionContainer').style.display = 'block'; const question = this.state.currentQuiz.questions[this.state.currentQuestion]; const progress = ((this.state.currentQuestion + 1) / this.state.totalQuestions) * 100; let html = `
السؤال ${this.state.currentQuestion + 1} من ${this.state.totalQuestions}
${this.state.coins}
${this.state.currentQuiz.timePerQuestion}
${question.question}
${question.category} - ${question.points} نقطة
`; const letters = ['أ', 'ب', 'ج', 'د']; question.options.forEach((option, index) => { html += `
${letters[index]}
${option} `; }); html += `
السابق تخطي (-1 عملة) ${this.state.currentQuestion === this.state.totalQuestions - 1 ? 'انهاء المسابقة' : 'التالي'}
`; document.getElementById('questionContainer').innerHTML = html; // بدء المؤقت this.startTimer(); // إضافة الأحداث this.addQuestionEventListeners(); }, // بدء المؤقت startTimer: function() { if (this.state.timer) clearInterval(this.state.timer); this.state.timeLeft = this.state.currentQuiz.timePerQuestion; const timerElement = document.getElementById('questionTimer'); this.state.timer = setInterval(() => { this.state.timeLeft--; if (timerElement) { timerElement.textContent = this.state.timeLeft; if (this.state.timeLeft <= 10) { timerElement.classList.add('warning'); } if (this.state.timeLeft <= 0) { this.skipQuestion(); } } }, 1000); }, // إضافة أحداث السؤال addQuestionEventListeners: function() { // اختيار الإجابة document.querySelectorAll('.option-btn').forEach(btn => { btn.addEventListener('click', (e) => { if (this.state.selectedAnswer !== null) return; const selectedIndex = parseInt(e.currentTarget.dataset.index); this.state.selectedAnswer = selectedIndex; // تحديث المظهر document.querySelectorAll('.option-btn').forEach(b => b.classList.remove('selected')); e.currentTarget.classList.add('selected'); // تفعيل زر التالي document.getElementById('nextQuestion').disabled = false; }); }); // السؤال السابق document.getElementById('prevQuestion')?.addEventListener('click', () => { if (this.state.currentQuestion > 0) { this.state.currentQuestion--; this.state.selectedAnswer = null; this.showQuestion(); } }); // تخطي السؤال document.getElementById('skipQuestion')?.addEventListener('click', () => { if (this.state.coins > 0) { this.skipQuestion(); } else { this.showMessage('ليس لديك عملات كافية للتخطي!', 'error'); } }); // التالي/الإنهاء document.getElementById('nextQuestion')?.addEventListener('click', () => { this.processAnswer(); }); }, // معالجة الإجابة processAnswer: function() { const question = this.state.currentQuiz.questions[this.state.currentQuestion]; const isCorrect = this.state.selectedAnswer === question.correct; // تسجيل النتيجة this.state.results.push({ question: question.question, selected: this.state.selectedAnswer, correct: question.correct, isCorrect: isCorrect, points: isCorrect ? question.points : 0 }); if (isCorrect) { this.state.score += question.points; this.state.coins += 3; // ربح 3 عملات للإجابة الصحيحة this.state.correctAnswers++; this.showMessage(`إجابة صحيحة! +${question.points} نقطة، +3 عملات`, 'success'); } else { this.state.wrongAnswers++; this.showMessage('إجابة خاطئة! -3 عملات', 'error'); } // الانتقال للسؤال التالي أو عرض النتائج if (this.state.currentQuestion < this.state.totalQuestions - 1) { this.state.currentQuestion++; this.state.selectedAnswer = null; setTimeout(() => this.showQuestion(), 1500); } else { this.showResults(); } this.saveState(); }, // تخطي السؤال skipQuestion: function() { if (this.state.coins > 0) { this.state.coins--; this.state.skippedAnswers++; this.state.results.push({ question: this.state.currentQuiz.questions[this.state.currentQuestion].question, selected: null, correct: null, isCorrect: null, points: 0, skipped: true }); if (this.state.currentQuestion < this.state.totalQuestions - 1) { this.state.currentQuestion++; this.state.selectedAnswer = null; this.showQuestion(); } else { this.showResults(); } this.saveState(); this.showMessage('تم تخطي السؤال! -1 عملة', 'warning'); } }, // عرض النتائج showResults: function() { if (this.state.timer) { clearInterval(this.state.timer); this.state.timer = null; } document.getElementById('questionContainer').style.display = 'none'; document.getElementById('resultContainer').style.display = 'block'; const percentage = (this.state.correctAnswers / this.state.totalQuestions) * 100; const earnedCoins = (this.state.correctAnswers * 3) - (this.state.wrongAnswers * 3) - (this.state.skippedAnswers * 1) - 3; const newMedal = this.checkNewMedal(); let html = `
${percentage >= 70 ? '🏆' : percentage >= 50 ? '🎉' : '💪'}

${percentage >= 70 ? 'مبارك! لقد تفوقت' : percentage >= 50 ? 'أحسنت! أداء جيد' : 'حاول مرة أخرى'}

${this.state.score} نقطة
دقة الإجابات
${percentage.toFixed(1)}%
الإجابات الصحيحة
${this.state.correctAnswers}/${this.state.totalQuestions}
العملات المكتسبة
${earnedCoins > 0 ? '+' : ''}${earnedCoins}
الميدالية الحالية
${this.getCurrentMedal().icon} ${this.getCurrentMedal().name}
مسابقة جديدة عرض التفاصيل الرئيسية
`; if (newMedal) { html += `
${newMedal.icon}

مبروك! لقد حصلت على ميدالية ${newMedal.name}

استمر في اللعب للحصول على ميداليات أعلى!

`; } document.getElementById('resultContainer').innerHTML = html; }, // عرض النتائج التفصيلية showDetailedResults: function() { let html = '

تفاصيل الإجابات

'; this.state.results.forEach((result, index) => { const question = this.state.currentQuiz.questions[index]; const letters = ['أ', 'ب', 'ج', 'د']; html += `
السؤال ${index + 1}
${question.question}
${!result.skipped ? `
إجابتك: ${letters[result.selected]}. ${question.options[result.selected]}
` : '
تم تخطي السؤال
'} ${result.isCorrect === false ? `
الإجابة الصحيحة: ${letters[question.correct]}. ${question.options[question.correct]}
` : ''}
${question.explanation}
${result.isCorrect ? `+${question.points} نقطة` : result.skipped ? '0 نقطة' : '0 نقطة'}
`; }); html += ` العودة `; document.getElementById('resultContainer').innerHTML = html; }, // عرض لوحة المتصدرين showLeaderboard: function() { document.getElementById('competitionSelection').style.display = 'none'; document.getElementById('leaderboardContainer').style.display = 'block'; let leaderboard = JSON.parse(localStorage.getItem('competition_leaderboard')) || []; // إضافة المستخدم الحالي إذا لم يكن موجود const currentUser = { name: localStorage.getItem('player_name') || 'اللاعب', coins: this.state.coins, medal: this.getCurrentMedal().name, score: this.state.score, date: new Date().toLocaleDateString('ar-SA') }; if (!leaderboard.some(player => player.name === currentUser.name)) { leaderboard.push(currentUser); } // ترتيب اللاعبين حسب النقاط leaderboard.sort((a, b) => b.coins - a.coins); let html = `

لوحة المتصدرين

`; leaderboard.forEach((player, index) => { html += ` `; }); html += `
الترتيب اللاعب العملات الميدالية آخر نشاط
${index + 1}
${player.name} ${player.coins} ${player.medal} ${player.date}
العودة
`; document.getElementById('leaderboardContainer').innerHTML = html; }, // عرض الميداليات showMedals: function() { document.getElementById('competitionSelection').style.display = 'none'; document.getElementById('medalsContainer').style.display = 'block'; let html = `

نظام الميداليات

اكسب عملات ذهبية للحصول على ميداليات أعلى!

`; this.medalLevels.forEach(medal => { const hasMedal = this.state.coins >= medal.threshold; html += `
${medal.icon}
${medal.name}
${hasMedal ? 'مكتسبة ✓' : `مطلوب: ${medal.threshold} عملة`}
${hasMedal ? '
' + this.getMedalDate(medal.threshold) + '
' : ''}
`; }); html += `
العودة
`; document.getElementById('medalsContainer').innerHTML = html; }, // الحصول على الميدالية الحالية getCurrentMedal: function() { let currentMedal = this.medalLevels[0]; for (const medal of this.medalLevels) { if (this.state.coins >= medal.threshold) { currentMedal = medal; } else { break; } } return currentMedal; }, // التحقق من ميدالية جديدة checkNewMedal: function() { const oldCoins = parseInt(localStorage.getItem('competition_coins')) || 3; const newCoins = this.state.coins; for (const medal of this.medalLevels) { if (newCoins >= medal.threshold && oldCoins < medal.threshold) { // إضافة الميدالية الجديدة if (!this.state.medals.includes(medal.name)) { this.state.medals.push(medal.name); this.saveState(); return medal; } } } return null; }, // تحديث عرض الميدالية updateMedalDisplay: function() { const medal = this.getCurrentMedal(); const medalElements = document.querySelectorAll('.current-medal'); medalElements.forEach(element => { element.innerHTML = `${medal.icon} ${medal.name}`; }); }, // الحصول على تاريخ الحصول على الميدالية getMedalDate: function(threshold) { // محاكاة - في نظام حقيقي، سيتم تخزين التواريخ const dates = { 9: '12/03/2024', 18: '15/03/2024', 27: '20/03/2024', 36: '25/03/2024', 45: '01/04/2024', 54: '10/04/2024', 63: '15/04/2024' }; return dates[threshold] || 'قريباً'; }, // إعادة تشغيل المسابقة restartQuiz: function() { if (this.state.coins < 3) { this.showMessage('تحتاج إلى 3 عملات ذهبية على الأقل للمشاركة!', 'error'); return; } this.state.currentQuestion = 0; this.state.score = 0; this.state.selectedAnswer = null; this.state.results = []; this.state.correctAnswers = 0; this.state.wrongAnswers = 0; this.state.skippedAnswers = 0; // خصم 3 عملات للمشاركة this.state.coins -= 3; this.saveState(); this.showQuestion(); }, // حفظ الحالة saveState: function() { localStorage.setItem('competition_coins', this.state.coins); localStorage.setItem('competition_medals', JSON.stringify(this.state.medals)); localStorage.setItem('competition_score', this.state.score); this.updateMedalDisplay(); }, // عرض رسالة showMessage: function(message, type = 'info') { const messageDiv = document.createElement('div'); messageDiv.className = `competition-message ${type}`; messageDiv.innerHTML = ` ${message} `; document.querySelector('.competition-modal-content')?.appendChild(messageDiv); setTimeout(() => { messageDiv.remove(); }, 3000); }, // إغلاق النافذة closeModal: function() { const modal = document.getElementById('competitionModal'); if (modal) modal.remove(); }, // إضافة الأحداث addEventListeners: function() { // إغلاق بالنقر خارج النافذة document.getElementById('competitionModal')?.addEventListener('click', (e) => { if (e.target.classList.contains('modal-overlay')) { this.closeCompetitionSystem(); } }); // إغلاق بالضغط على ESC document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && this.state.isCompetitionOpen) { this.closeCompetitionSystem(); } }); } }; // تهيئة النظام عند تحميل الصفحة document.addEventListener('DOMContentLoaded', function() { window.competitionSystem.init(); }); </script> <script src="questions-library.js"></script> <script src="quiz-system/questions.js"></script> <script src="quiz-system/quiz.js"></script> <script src="quiz-system/loader.js"></script> <script src="surah-al-baqarah.js"></script> <script src="hoor-massive-data.js"></script> <script src="masjid-network.js"></script> <script src="questions-library.js"></script> <script src="competition-system.js"></script> <script src="quiz-system/questions.js"></script> <script src="quiz-system/quiz.js"></script> <script src="quiz-system/init.js"></script> <script> // كود تأكيد التحميل console.log('🔍 التحقق من تحميل competition-system.js...'); </script> <script> // نظام المسابقات الإسلامية const IslamicCompetition = { // إعدادات النظام config: { baseCoins: 100, pointsPerQuestion: 10, medalThresholds: [100, 500, 1000, 5000, 10000, 50000, 100000], medalNames: ["حديث", "مبتدئ", "متوسط", "متقدم", "خبير", "عالم", "حافظ"] }, // حالة المستخدم userState: { coins: parseInt(localStorage.getItem('islamic_coins')) || 100, points: parseInt(localStorage.getItem('islamic_points')) || 0, level: parseInt(localStorage.getItem('islamic_level')) || 1, medals: JSON.parse(localStorage.getItem('islamic_medals')) || [], completedQuizzes: JSON.parse(localStorage.getItem('completed_quizzes')) || [], dailyStreak: parseInt(localStorage.getItem('daily_streak')) || 0, lastPlayDate: localStorage.getItem('last_play_date') || null }, // مكتبة الأسئلة القابلة للتوسعة questionLibrary: { // القرآن الكريم quran: { title: "القرآن الكريم", icon: "📖", description: "أسئلة عن كتاب الله تعالى", difficulty: "متوسط", timePerQuestion: 30, questions: [ { id: "q1", question: "كم عدد سور القرآن الكريم؟", options: ["110", "114", "120", "124"], correct: 1, explanation: "عدد سور القرآن 114 سورة", points: 10, category: "معلومات عامة" }, { id: "q2", question: "ما هي أطول سورة في القرآن؟", options: ["البقرة", "النساء", "آل عمران", "المائدة"], correct: 0, explanation: "سورة البقرة هي أطول سور القرآن (286 آية)", points: 15, category: "معلومات عامة" }, { id: "q3", question: "ما هي أقصر سورة في القرآن؟", options: ["الكوثر", "النصر", "العصر", "الكافرون"], correct: 0, explanation: "سورة الكوثر هي أقصر سورة (3 آيات)", points: 10, category: "معلومات عامة" }, { id: "q4", question: "كم مرة ذكر اسم النبي محمد صلى الله عليه وسلم في القرآن؟", options: ["3", "4", "5", "6"], correct: 1, explanation: "ذكر اسم النبي محمد صلى الله عليه وسلم 4 مرات في القرآن", points: 20, category: "أسئلة متقدمة" }, { id: "q5", question: "ما هي السورة التي تسمى قلب القرآن؟", options: ["البقرة", "يس", "الرحمن", "الفاتحة"], correct: 1, explanation: "سورة يس تسمى قلب القرآن كما ورد في الحديث", points: 15, category: "أسئلة متقدمة" } ] }, // السيرة النبوية seerah: { title: "السيرة النبوية", icon: "🕌", description: "أسئلة عن حياة رسول الله صلى الله عليه وسلم", difficulty: "سهل", timePerQuestion: 25, questions: [ { id: "s1", question: "كم كان عمر النبي صلى الله عليه وسلم عندما بُعث؟", options: ["30", "35", "40", "45"], correct: 2, explanation: "بُعث صلى الله عليه وسلم وعمره 40 سنة", points: 10, category: "معلومات أساسية" }, { id: "s2", question: "من هي أول زوجة تزوجها النبي صلى الله عليه وسلم؟", options: ["عائشة", "خديجة", "سودة", "حفصة"], correct: 1, explanation: "خديجة بنت خويلد رضي الله عنها", points: 10, category: "معلومات أساسية" }, { id: "s3", question: "كم غزوة غزاها النبي صلى الله عليه وسلم؟", options: ["19", "23", "27", "31"], correct: 2, explanation: "غزا صلى الله عليه وسلم 27 غزوة", points: 15, category: "أسئلة متقدمة" } ] }, // الحديث الشريف hadith: { title: "الحديث النبوي", icon: "💬", description: "أسئلة عن أحاديث رسول الله صلى الله عليه وسلم", difficulty: "صعب", timePerQuestion: 35, questions: [ { id: "h1", question: "كم عدد أحاديث البخاري الصحيحة؟", options: ["7275", "7563", "7890", "8100"], correct: 1, explanation: "صحيح البخاري يحتوي على 7563 حديثاً", points: 20, category: "معلومات عامة" }, { id: "h2", question: "من هو أكثر الصحابة رواية للحديث؟", options: ["أبو هريرة", "عائشة", "ابن عمر", "أنس بن مالك"], correct: 0, explanation: "أبو هريرة رضي الله عنه أكثر الصحابة رواية للحديث", points: 15, category: "معلومات عامة" } ] }, // الفقه الإسلامي fiqh: { title: "الفقه الإسلامي", icon: "⚖️", description: "أسئلة عن الأحكام الشرعية", difficulty: "متوسط", timePerQuestion: 30, questions: [ { id: "f1", question: "كم عدد أركان الإسلام؟", options: ["4", "5", "6", "7"], correct: 1, explanation: "أركان الإسلام خمسة: الشهادتان، الصلاة، الزكاة، الصوم، الحج", points: 10, category: "أساسيات" }, { id: "f2", question: "ما هي شروط صحة الصلاة؟", options: ["5", "7", "9", "11"], correct: 2, explanation: "شروط صحة الصلاة تسعة منها: الإسلام، العقل، الطهارة، ستر العورة...", points: 20, category: "أسئلة متقدمة" } ] } }, // تهيئة النظام init: function() { this.checkDailyReward(); this.updateDisplay(); this.loadUserStats(); console.log("✅ نظام المسابقات الإسلامية جاهز!"); }, // فتح نافذة المسابقات openCompetition: function() { this.createCompetitionModal(); }, // إنشاء نافذة المسابقات createCompetitionModal: function() { // إنشاء عنصر النافذة const modal = document.createElement('div'); modal.className = 'competition-modal'; modal.id = 'competitionModal'; modal.innerHTML = `

المسابقات الإسلامية

${this.userState.coins}
${this.userState.points}
المستوى ${this.userState.level}

اختر نوع المسابقة

المتصدرين الجوائز تصدير النتائج
`; document.body.appendChild(modal); this.renderCompetitionGrid(); }, // عرض شبكة المسابقات renderCompetitionGrid: function() { const grid = document.getElementById('competitionGrid'); if (!grid) return; let html = ''; for (const [key, quiz] of Object.entries(this.questionLibrary)) { const isCompleted = this.userState.completedQuizzes.includes(key); const completionRate = isCompleted ? '100%' : '0%'; html += `
${quiz.icon}

${quiz.title}

${quiz.description}

${quiz.questions.length} سؤال ${quiz.timePerQuestion} ثانية/سؤال ${quiz.difficulty}
${isCompleted ? ' مكتمل' : ''}
`; } grid.innerHTML = html; }, // بدء المسابقة startQuiz: function(quizType) { const quiz = this.questionLibrary[quizType]; if (!quiz) return; document.getElementById('competitionSelection').style.display = 'none'; document.getElementById('questionContainer').style.display = 'block'; // تهيئة حالة المسابقة this.currentQuiz = { type: quizType, questions: [...quiz.questions], currentQuestionIndex: 0, score: 0, correctAnswers: 0, wrongAnswers: 0, startTime: Date.now() }; // خلط الأسئلة this.shuffleQuestions(); // عرض السؤال الأول this.showQuestion(); // بدء المؤقت this.startTimer(); }, // خلط الأسئلة shuffleQuestions: function() { if (!this.currentQuiz) return; for (let i = this.currentQuiz.questions.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [this.currentQuiz.questions[i], this.currentQuiz.questions[j]] = [this.currentQuiz.questions[j], this.currentQuiz.questions[i]]; } }, // عرض السؤال showQuestion: function() { if (!this.currentQuiz) return; const container = document.getElementById('questionContainer'); const question = this.currentQuiz.questions[this.currentQuiz.currentQuestionIndex]; const questionNumber = this.currentQuiz.currentQuestionIndex + 1; const totalQuestions = this.currentQuiz.questions.length; const progress = (questionNumber / totalQuestions) * 100; container.innerHTML = `
السؤال ${questionNumber} من ${totalQuestions}
30
${question.category}

${question.question}

${question.points} نقطة
${question.options.map((option, index) => ` ${String.fromCharCode(1570 + index)} ${option} `).join('')}
تخطي (5 عملات) التالي

شرح الإجابة:

`; this.resetTimer(); }, // اختيار الإجابة selectAnswer: function(selectedIndex) { const question = this.currentQuiz.questions[this.currentQuiz.currentQuestionIndex]; const isCorrect = selectedIndex === question.correct; const optionButtons = document.querySelectorAll('.option-btn'); const nextBtn = document.getElementById('nextBtn'); const explanationBox = document.getElementById('explanationBox'); const explanationText = document.getElementById('explanationText'); // تلوين الإجابات optionButtons.forEach((btn, index) => { btn.disabled = true; if (index === question.correct) { btn.classList.add('correct'); } else if (index === selectedIndex && !isCorrect) { btn.classList.add('wrong'); } }); // تسجيل النتيجة if (isCorrect) { this.currentQuiz.score += question.points; this.currentQuiz.correctAnswers++; this.showNotification(`إجابة صحيحة! +${question.points} نقطة`, 'success'); } else { this.currentQuiz.wrongAnswers++; this.showNotification('إجابة خاطئة!', 'error'); } // عرض الشرح if (explanationText) { explanationText.textContent = question.explanation; explanationBox.style.display = 'block'; } // إظهار زر التالي if (nextBtn) { nextBtn.style.display = 'block'; } // إيقاف المؤقت clearInterval(this.timerInterval); }, // تخطي السؤال skipQuestion: function() { if (this.userState.coins < 5) { this.showNotification('ليس لديك عملات كافية للتخطي!', 'error'); return; } this.userState.coins -= 5; this.currentQuiz.wrongAnswers++; this.updateDisplay(); this.saveUserState(); this.nextQuestion(); }, // السؤال التالي nextQuestion: function() { this.currentQuiz.currentQuestionIndex++; if (this.currentQuiz.currentQuestionIndex < this.currentQuiz.questions.length) { this.showQuestion(); } else { this.showResults(); } }, // عرض النتائج showResults: function() { document.getElementById('questionContainer').style.display = 'none'; document.getElementById('resultContainer').style.display = 'block'; const container = document.getElementById('resultContainer'); const totalTime = Math.floor((Date.now() - this.currentQuiz.startTime) / 1000); const accuracy = (this.currentQuiz.correctAnswers / this.currentQuiz.questions.length) * 100; // حساب المكافآت const coinsEarned = Math.floor(this.currentQuiz.score * 0.5); const pointsEarned = this.currentQuiz.score; // تحديث حالة المستخدم this.userState.coins += coinsEarned; this.userState.points += pointsEarned; this.userState.completedQuizzes.push(this.currentQuiz.type); // التحقق من الترقية this.checkLevelUp(); // حفظ الحالة this.saveUserState(); container.innerHTML = `
${accuracy >= 70 ? '🏆' : accuracy >= 50 ? '🎉' : '💪'}

${accuracy >= 70 ? 'ممتاز!' : accuracy >= 50 ? 'جيد جداً!' : 'حاول مرة أخرى!'}

${this.currentQuiz.score}
النقاط
${this.currentQuiz.correctAnswers}/${this.currentQuiz.questions.length}
الإجابات الصحيحة
${accuracy.toFixed(1)}%
الدقة
${totalTime} ثانية
الوقت

المكافآت المكتسبة:

+${coinsEarned} عملة
+${pointsEarned} نقطة
مسابقة أخرى مشاركة النتيجة
`; }, // نظام المؤقت timerInterval: null, startTimer: function() { const timeDisplay = document.getElementById('timeLeft'); if (!timeDisplay) return; let timeLeft = 30; timeDisplay.textContent = timeLeft; this.timerInterval = setInterval(() => { timeLeft--; timeDisplay.textContent = timeLeft; if (timeLeft <= 10) { timeDisplay.parentElement.classList.add('warning'); } if (timeLeft <= 0) { clearInterval(this.timerInterval); this.skipQuestion(); } }, 1000); }, resetTimer: function() { if (this.timerInterval) { clearInterval(this.timerInterval); } const timerDisplay = document.getElementById('timerDisplay'); if (timerDisplay) { timerDisplay.classList.remove('warning'); } }, // عرض لوحة المتصدرين showLeaderboard: function() { this.showSection('leaderboardContainer'); const container = document.getElementById('leaderboardContainer'); // محاكاة بيانات المتصدرين (في نظام حقيقي سيكون من قاعدة بيانات) const leaderboardData = [ { name: "أحمد محمد", points: 15000, level: 10, medals: 7 }, { name: "فاطمة علي", points: 12500, level: 9, medals: 6 }, { name: "محمد إبراهيم", points: 11000, level: 8, medals: 5 }, { name: "سارة عبدالله", points: 9500, level: 7, medals: 4 }, { name: "خالد حسن", points: 8000, level: 6, medals: 3 } ]; container.innerHTML = `

المتصدرين

الأسبوع الشهر الكل
${leaderboardData.map((user, index) => `
${index + 1}
${user.name.charAt(0)}
${user.name}
المستوى ${user.level}
${user.points} ${user.medals}
`).join('')}
موقعك
15
`; }, // عرض الجوائز showRewards: function() { this.showSection('rewardsContainer'); const container = document.getElementById('rewardsContainer'); const rewards = [ { id: 1, name: "الميدالية الذهبية", icon: "🥇", cost: 1000, description: "للخبراء" }, { id: 2, name: "الميدالية الفضية", icon: "🥈", cost: 500, description: "للمتقدمين" }, { id: 3, name: "الميدالية البرونزية", icon: "🥉", cost: 250, description: "للمبتدئين" }, { id: 4, name: "شهادة التميز", icon: "📜", cost: 2000, description: "للحفاظ" }, { id: 5, name: "درع التفوق", icon: "🛡️", cost: 1500, description: "للمتميزين" } ]; container.innerHTML = `

متجر الجوائز

${this.userState.coins} عملة
${rewards.map(reward => `
${reward.icon}

${reward.name}

${reward.description}

${reward.cost}
شراء
`).join('')}

المكافآت اليومية

${[1, 2, 3, 4, 5, 6, 7].map(day => `
${day}
+${day * 10}
`).join('')}
احصل على مكافأتك اليومية
`; }, // شراء جائزة buyReward: function(rewardId) { // محاكاة عملية الشراء this.showNotification('تم شراء الجائزة بنجاح!', 'success'); this.updateDisplay(); }, // المكافأة اليومية checkDailyReward: function() { const today = new Date().toDateString(); if (this.userState.lastPlayDate !== today) { this.userState.dailyStreak = this.userState.lastPlayDate ? (new Date(today) - new Date(this.userState.lastPlayDate) === 86400000 ? this.userState.dailyStreak + 1 : 1) : 1; this.userState.lastPlayDate = today; this.saveUserState(); } }, claimDailyReward: function() { const reward = (this.userState.dailyStreak * 10) + 50; this.userState.coins += reward; this.saveUserState(); this.updateDisplay(); this.showNotification(`+${reward} عملة! استمرارية ${this.userState.dailyStreak} يوم`, 'success'); }, // التحقق من الترقية checkLevelUp: function() { const oldLevel = this.userState.level; this.userState.level = Math.floor(this.userState.points / 1000) + 1; if (this.userState.level > oldLevel) { const coinsReward = this.userState.level * 100; this.userState.coins += coinsReward; this.showNotification(`مبروك! ترقية للمستوى ${this.userState.level}! +${coinsReward} عملة`, 'success'); } }, // مشاركة النتائج shareResults: function() { const text = `حصلت على ${this.currentQuiz.score} نقطة في المسابقة الإسلامية!`; if (navigator.share) { navigator.share({ title: 'نتيجة المسابقة الإسلامية', text: text, url: window.location.href }); } else { navigator.clipboard.writeText(text); this.showNotification('تم نسخ النتيجة!', 'info'); } }, // تصدير البيانات exportData: function() { const data = { userState: this.userState, exportDate: new Date().toISOString(), achievements: this.getAchievements() }; const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `islamic_competition_${new Date().toISOString().slice(0,10)}.json`; a.click(); this.showNotification('تم تصدير بياناتك!', 'success'); }, // الحصول على الإنجازات getAchievements: function() { return { completedQuizzes: this.userState.completedQuizzes.length, totalPoints: this.userState.points, currentLevel: this.userState.level, medalsEarned: this.userState.medals.length, dailyStreak: this.userState.dailyStreak }; }, // حفظ حالة المستخدم saveUserState: function() { localStorage.setItem('islamic_coins', this.userState.coins); localStorage.setItem('islamic_points', this.userState.points); localStorage.setItem('islamic_level', this.userState.level); localStorage.setItem('islamic_medals', JSON.stringify(this.userState.medals)); localStorage.setItem('completed_quizzes', JSON.stringify(this.userState.completedQuizzes)); localStorage.setItem('daily_streak', this.userState.dailyStreak); localStorage.setItem('last_play_date', this.userState.lastPlayDate); this.updateDisplay(); }, // تحديث العرض updateDisplay: function() { const coinCount = document.getElementById('coinCount'); const pointCount = document.getElementById('pointCount'); if (coinCount) coinCount.textContent = this.userState.coins; if (pointCount) pointCount.textContent = this.userState.points; }, // تحميل إحصائيات المستخدم loadUserStats: function() { console.log('📊 إحصائيات المستخدم:', this.userState); }, // إظهار القسم showSection: function(sectionId) { const sections = ['competitionSelection', 'questionContainer', 'resultContainer', 'leaderboardContainer', 'rewardsContainer']; sections.forEach(id => { const element = document.getElementById(id); if (element) { element.style.display = id === sectionId ? 'block' : 'none'; } }); }, // إغلاق المسابقة closeCompetition: function() { const modal = document.getElementById('competitionModal'); if (modal) modal.remove(); if (this.timerInterval) clearInterval(this.timerInterval); }, // إظهار إشعار showNotification: function(message, type = 'info') { const notification = document.createElement('div'); notification.className = `competition-notification ${type}`; notification.innerHTML = ` ${message} `; document.body.appendChild(notification); setTimeout(() => { notification.remove(); }, 3000); } }; // تهيئة النظام عند تحميل الصفحة window.addEventListener('load', function() { IslamicCompetition.init(); // إضافة زر المسابقات إذا لم يكن موجوداً if (!document.querySelector('.competition-btn')) { const compBtn = document.createElement('button'); compBtn.className = 'competition-btn'; compBtn.innerHTML = ' المسابقات الإسلامية'; compBtn.onclick = () => IslamicCompetition.openCompetition(); document.body.appendChild(compBtn); } }); // دالة لفتح المسابقات من الأزرار الأخرى function openCompetition() { IslamicCompetition.openCompetition(); } </script> <style> /* أنماط نظام المسابقات */ .competition-btn { position: fixed; bottom: 120px; right: 20px; background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%); color: white; padding: 12px 24px; border-radius: 25px; border: none; cursor: pointer; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3); z-index: 1000; font-size: 14px; display: flex; align-items: center; gap: 8px; animation: float 3s ease-in-out infinite; } @keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } } .competition-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); display: flex; justify-content: center; align-items: center; z-index: 10010; backdrop-filter: blur(10px); } .competition-container { background: linear-gradient(135deg, #1a5e25 0%, #0d4d1a 100%); width: 95%; max-width: 900px; max-height: 90vh; border-radius: 20px; overflow: hidden; border: 3px solid #d4af37; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); } .competition-header { background: rgba(0, 0, 0, 0.3); padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(212, 175, 55, 0.3); } .competition-header h2 { color: #d4af37; margin: 0; font-size: 24px; } .competition-stats { display: flex; gap: 20px; } .stat-item { background: rgba(255, 255, 255, 0.1); padding: 8px 15px; border-radius: 15px; display: flex; align-items: center; gap: 8px; color: white; } .close-btn { background: rgba(255, 255, 255, 0.1); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; } .competition-body { padding: 20px; max-height: 60vh; overflow-y: auto; } .competition-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; } .competition-card { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 20px; cursor: pointer; transition: all 0.3s; border: 2px solid transparent; } .competition-card:hover { border-color: #d4af37; transform: translateY(-5px); background: rgba(212, 175, 55, 0.1); } .competition-card.completed { border-color: #4CAF50; } .competition-icon { font-size: 40px; margin-bottom: 15px; text-align: center; } .competition-info h4 { color: white; margin: 0 0 10px 0; } .competition-info p { color: rgba(255, 255, 255, 0.7); font-size: 14px; margin: 0 0 15px 0; } .competition-meta { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-bottom: 10px; } .progress-bar { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; margin-top: 10px; } .progress-fill { height: 100%; background: #4CAF50; transition: width 0.3s; } .completed-badge { background: #4CAF50; color: white; padding: 3px 10px; border-radius: 10px; font-size: 12px; display: inline-block; margin-top: 10px; } /* أنماط الأسئلة */ .question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; color: white; } .question-progress { flex: 1; } .timer-display { background: rgba(0, 0, 0, 0.3); padding: 8px 15px; border-radius: 15px; font-size: 18px; font-weight: bold; } .timer-display.warning { color: #FF9800; animation: pulse 1s infinite; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } .question-card { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 25px; margin-bottom: 20px; } .question-category { color: #d4af37; font-size: 14px; margin-bottom: 10px; } .question-text { color: white; font-size: 20px; margin-bottom: 20px; line-height: 1.5; } .question-points { color: #4CAF50; font-weight: bold; margin-bottom: 20px; } .options-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 25px; } .option-btn { background: rgba(255, 255, 255, 0.05); border: 2px solid transparent; border-radius: 12px; padding: 15px; color: white; text-align: right; cursor: pointer; display: flex; align-items: center; gap: 15px; transition: all 0.3s; } .option-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); border-color: rgba(212, 175, 55, 0.5); } .option-btn.correct { background: rgba(76, 175, 80, 0.2); border-color: #4CAF50; } .option-btn.wrong { background: rgba(244, 67, 54, 0.2); border-color: #F44336; } .option-btn:disabled { opacity: 0.7; cursor: not-allowed; } .option-letter { background: rgba(212, 175, 55, 0.2); color: #d4af37; width: 35px; height: 35px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; } .question-navigation { display: flex; justify-content: space-between; gap: 15px; } .nav-btn { flex: 1; padding: 12px; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 12px; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; } .nav-btn:hover:not(:disabled) { background: rgba(212, 175, 55, 0.2); } .nav-btn:disabled { opacity: 0.5; cursor: not-allowed; } .explanation-box { background: rgba(33, 150, 243, 0.1); border: 1px solid rgba(33, 150, 243, 0.3); border-radius: 12px; padding: 20px; margin-top: 20px; } .explanation-box h4 { color: #2196F3; margin: 0 0 10px 0; } .explanation-box p { color: rgba(255, 255, 255, 0.8); margin: 0; line-height: 1.6; } /* أنماط النتائج */ .result-header { text-align: center; margin-bottom: 30px; } .result-icon { font-size: 60px; margin-bottom: 15px; } .result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 30px; } .stat-card { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 20px; text-align: center; } .stat-value { color: #d4af37; font-size: 28px; font-weight: bold; margin-bottom: 5px; } .stat-label { color: rgba(255, 255, 255, 0.7); font-size: 14px; } .rewards-earned { background: rgba(212, 175, 55, 0.1); border-radius: 15px; padding: 20px; margin-bottom: 30px; } .rewards-earned h4 { color: #d4af37; margin: 0 0 15px 0; } .rewards-list { display: flex; gap: 20px; } .reward-item { display: flex; align-items: center; gap: 8px; color: white; } .result-actions { display: flex; gap: 15px; } .action-btn-primary { flex: 1; background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%); border: none; border-radius: 15px; padding: 15px; color: white; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.3s; } .action-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3); } .action-btn-secondary { flex: 1; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 15px; padding: 15px; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.3s; } .action-btn-secondary:hover { background: rgba(255, 255, 255, 0.2); } /* أنماط لوحة المتصدرين */ .leaderboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .leaderboard-header h3 { color: white; margin: 0; } .leaderboard-filters { display: flex; gap: 10px; } .filter-btn { background: rgba(255, 255, 255, 0.1); border: none; border-radius: 15px; padding: 8px 15px; color: white; cursor: pointer; font-size: 12px; } .filter-btn.active { background: #d4af37; } .leaderboard-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; } .leaderboard-item { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 15px; display: flex; align-items: center; gap: 15px; color: white; } .leaderboard-item.top-1 { background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%); border: 2px solid gold; } .leaderboard-item.top-2 { background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.1) 100%); border: 2px solid silver; } .leaderboard-item.top-3 { background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.1) 100%); border: 2px solid #cd7f32; } .rank { background: rgba(212, 175, 55, 0.2); color: #d4af37; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; } .user-avatar { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; } .user-info { flex: 1; } .user-name { font-weight: bold; } .user-level { font-size: 12px; color: rgba(255, 255, 255, 0.7); } .user-stats { display: flex; gap: 15px; } .user-position { background: rgba(212, 175, 55, 0.1); border-radius: 15px; padding: 20px; text-align: center; } .position-label { color: rgba(255, 255, 255, 0.7); font-size: 14px; margin-bottom: 5px; } .position-value { color: #d4af37; font-size: 32px; font-weight: bold; } /* أنماط الجوائز */ .rewards-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .rewards-header h3 { color: white; margin: 0; } .user-coins { background: rgba(212, 175, 55, 0.2); color: #d4af37; padding: 8px 15px; border-radius: 15px; font-weight: bold; } .rewards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-bottom: 30px; } .reward-card { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 20px; text-align: center; transition: all 0.3s; } .reward-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); } .reward-icon { font-size: 40px; margin-bottom: 15px; } .reward-info h4 { color: white; margin: 0 0 10px 0; } .reward-info p { color: rgba(255, 255, 255, 0.7); font-size: 12px; margin: 0 0 15px 0; } .reward-cost { color: #d4af37; font-weight: bold; margin-bottom: 15px; } .buy-btn { background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%); border: none; border-radius: 10px; padding: 8px 20px; color: white; cursor: pointer; width: 100%; transition: all 0.3s; } .buy-btn:hover:not(:disabled) { transform: scale(1.05); } .buy-btn:disabled { opacity: 0.5; cursor: not-allowed; } .daily-rewards { background: rgba(0, 0, 0, 0.2); border-radius: 15px; padding: 20px; } .daily-rewards h4 { color: white; margin: 0 0 20px 0; text-align: center; } .streak-display { display: flex; justify-content: space-between; margin-bottom: 20px; } .streak-day { background: rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 10px; text-align: center; flex: 1; margin: 0 5px; } .streak-day.active { background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%); } .day-number { color: white; font-weight: bold; margin-bottom: 5px; } .day-reward { color: #4CAF50; font-size: 12px; font-weight: bold; } .claim-btn { background: linear-gradient(135deg, #2196F3 0%, #0d47a1 100%); border: none; border-radius: 15px; padding: 15px; color: white; cursor: pointer; font-weight: bold; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.3s; } .claim-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3); } /* إشعارات */ .competition-notification { position: fixed; top: 20px; right: 50%; transform: translateX(50%); background: rgba(0, 0, 0, 0.9); color: white; padding: 15px 30px; border-radius: 25px; z-index: 10011; display: flex; align-items: center; gap: 10px; animation: slideDown 0.3s ease; border: 2px solid; max-width: 80%; } .competition-notification.success { border-color: #4CAF50; } .competition-notification.error { border-color: #F44336; } .competition-notification.warning { border-color: #FF9800; } .competition-notification.info { border-color: #2196F3; } @keyframes slideDown { from { transform: translateX(50%) translateY(-100px); opacity: 0; } to { transform: translateX(50%) translateY(0); opacity: 1; } } .competition-footer { background: rgba(0, 0, 0, 0.3); padding: 15px 20px; display: flex; gap: 10px; border-top: 2px solid rgba(212, 175, 55, 0.3); } /* التجاوب مع الشاشات الصغيرة */ @media (max-width: 768px) { .competition-container { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; } .competition-grid { grid-template-columns: 1fr; } .result-stats { grid-template-columns: repeat(2, 1fr); } .rewards-grid { grid-template-columns: repeat(2, 1fr); } .competition-footer { flex-direction: column; } .competition-btn { bottom: 80px; right: 10px; padding: 10px 15px; font-size: 12px; } } </style>