Sindbad~EG File Manager
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WhatsApp Messenger Clone</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.socket.io/4.0.1/socket.io.min.js"></script>
<style>
body {
background-color: #e5ddd5;
font-family: Arial, sans-serif;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}
.chat-container {
width: 100%;
max-width: 600px;
height: 90vh;
background: #fff;
border-radius: 10px;
overflow: hidden;
box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
display: flex;
flex-direction: column;
}
.chat-header {
background: #075E54;
color: white;
padding: 15px;
text-align: center;
font-size: 18px;
font-weight: bold;
}
.chat-body {
flex: 1;
overflow-y: auto;
padding: 15px;
}
.message {
margin-bottom: 10px;
padding: 10px;
border-radius: 8px;
max-width: 75%;
clear: both;
}
.sent {
background: #dcf8c6;
float: right;
text-align: right;
}
.received {
background: #fff;
float: left;
}
.chat-footer {
display: flex;
align-items: center;
padding: 10px;
border-top: 1px solid #ddd;
background: #fff;
flex-direction: column;
}
.chat-footer input {
width: 100%;
padding: 10px;
border: none;
border-radius: 20px;
outline: none;
margin: 5px 0;
background: #f1f1f1;
text-align: center;
}
.message-area {
display: flex;
width: 100%;
}
.message-area textarea {
flex: 1;
padding: 10px;
border-radius: 20px;
border: 1px solid #ddd;
background: #f1f1f1;
resize: none;
}
.chat-footer button {
background: #25D366;
border: none;
padding: 10px 15px;
color: white;
border-radius: 50%;
cursor: pointer;
margin-left: 5px;
}
.response-box {
padding: 10px;
font-size: 14px;
text-align: center;
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-header">WhatsApp Clone</div>
<div class="chat-body" id="chatBody">
<!-- Messages will appear here -->
</div>
<div class="chat-footer">
<input type="text" id="phoneNumberInput" placeholder="Enter phone number..." />
<div class="message-area">
<textarea type="text" id="messageInput" placeholder="Type a message..." rows="2"></textarea>
<button id="sendButton">➤</button>
</div>
<div id="response" class="response-box"></div>
</div>
</div>
<script>
const socket = io('wss://whatsapp.numerotech.com', {
transports: ['websocket']
});
socket.on('connect', () => {
console.log('WebSocket connected!');
});
socket.on('connect_error', (err) => {
console.error('WebSocket connection error: ', err);
});
socket.on('connect_timeout', () => {
console.error('WebSocket connection timeout');
});
socket.on('disconnect', (reason) => {
console.error('WebSocket disconnected: ', reason);
});
// Function to send message
function sendMessage() {
var phoneNumber = $("#phoneNumberInput").val().trim();
var message = $("#messageInput").val().trim();
if (phoneNumber === "") {
alert("Please enter a phone number.");
return;
}
socket.emit("sio_send_message",{ "phoneNumber": phoneNumber, "message": message })
// if (message !== "") {
// $.ajax({
// url: "/send_message",
// type: "POST",
// contentType: "application/json",
// data: JSON.stringify({ phoneNumber: phoneNumber, message: message }),
// success: function(response) {
// $("#chatBody").append(`<div class="message sent">${message}</div>`);
// $("#messageInput").val("");
// scrollToBottom();
// $("#response").html(`
// <p><strong>Status:</strong> ${response.reply}</p>
// `);
// },
// error: function() {
// $("#response").html(`<p class="text-danger">Error sending message.</p>`);
// }
// });
// }
}
// Send message when clicking the send button
$("#sendButton").click(function() {
sendMessage();
});
// Send message when pressing Enter
$("#messageInput").keypress(function(event) {
if (event.which === 13) { // 13 is the Enter key
sendMessage();
}
});
// Display sent message
socket.on("sio_display_sent_message", function(data) {
$("#messageInput").val("");
$("#chatBody").append(`<div class="message sent"> ${data.message}</div>`);
scrollToBottom();
});
// Receive message
socket.on("new_message", function(data) {
$("#chatBody").append(`<div class="message received">${data.message}</div>`);
scrollToBottom();
});
socket.on("sio_error", function(data) {
alert(data.message);
});
// Auto scroll to bottom
function scrollToBottom() {
$("#chatBody").scrollTop($("#chatBody")[0].scrollHeight);
}
</script>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists