Sindbad~EG File Manager

Current Path : /home/numerotech/whatsapp.numerotech.com/whatsapp/core/templates/whatsapp_temp/
Upload File :
Current File : //home/numerotech/whatsapp.numerotech.com/whatsapp/core/templates/whatsapp_temp/index_old.html

<!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 input {
            flex: 1;
        }
        .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">
                <input type="text" id="messageInput" placeholder="Type a message..." />
                <button id="sendButton">➤</button>
            </div>
            <div id="response" class="response-box"></div>
        </div>
    </div>

    <script>
        var socket = io();

        // 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;
            }

            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>Message Sent:</strong> ${message}</p>
                            <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();
            }
        });

        // Receive message
        socket.on("new_message", function(data) {
            $("#chatBody").append(`<div class="message received">${data.message}</div>`);
            scrollToBottom();
        });

        // 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