ghostchat / chat.html
sohaibajaj's picture
اريد برنامج دردشة بي شكل عصري واستخدام مميز وبدون تسجيل
fefe669 verified
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GhostChat — دردشة مجهولة</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
</head>
<body class="bg-gray-100 font-sans">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-8">
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- Chat Header -->
<div class="bg-purple-600 text-white p-4 flex items-center">
<div class="w-10 h-10 rounded-full bg-white text-purple-600 flex items-center justify-center mr-3">
<i data-feather="ghost"></i>
</div>
<div>
<h2 class="font-bold">غرفة دردشة مجهولة</h2>
<p class="text-sm opacity-80">متصل الآن: <span id="online-count">0</span> أشخاص</p>
</div>
</div>
<!-- Chat Messages -->
<div id="chat-messages" class="h-96 p-4 overflow-y-auto space-y-3">
<!-- Messages will appear here -->
</div>
<!-- Message Input -->
<div class="border-t p-4 flex">
<input type="text" id="message-input" placeholder="اكتب رسالتك هنا..." class="flex-1 border rounded-l-full py-2 px-4 focus:outline-none focus:ring-2 focus:ring-purple-500">
<button id="send-button" class="bg-purple-600 text-white px-6 rounded-r-full hover:bg-purple-700 transition">
<i data-feather="send"></i>
</button>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script>
feather.replace();
// Simple chat functionality (would use WebSockets in production)
const messageInput = document.getElementById('message-input');
const sendButton = document.getElementById('send-button');
const chatMessages = document.getElementById('chat-messages');
function addMessage(message, isMe = false) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex ${isMe ? 'justify-end' : 'justify-start'}`;
const bubble = document.createElement('div');
bubble.className = `max-w-xs lg:max-w-md px-4 py-2 rounded-xl ${isMe ? 'bg-purple-600 text-white' : 'bg-gray-200'}`;
bubble.textContent = message;
messageDiv.appendChild(bubble);
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
sendButton.addEventListener('click', () => {
const message = messageInput.value.trim();
if (message) {
addMessage(message, true);
messageInput.value = '';
// Simulate random response
setTimeout(() => {
const responses = [
"مرحبًا! كيف حالك؟",
"هذه الدردشة مجهولة تمامًا",
"يمكنك التحدث بحرية هنا",
"هل تفضل الدردشة النصية أم الصوتية؟",
"👻"
];
addMessage(responses[Math.floor(Math.random() * responses.length)]);
}, 1000);
}
});
messageInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
sendButton.click();
}
});
// Simulate online users count
setInterval(() => {
const count = Math.floor(Math.random() * 50) + 1;
document.getElementById('online-count').textContent = count;
}, 3000);
</script>
<script src="script.js"></script>
</body>
</html>