Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Chat Interface</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- background-color: #f0f0f0;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- margin: 0;
- }
- .chat-container {
- background-color: #fff;
- border: 1px solid #ccc;
- border-radius: 10px;
- padding: 20px;
- width: 300px;
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
- }
- .chat-container h2 {
- margin-top: 0;
- }
- .message-box {
- width: 100%;
- height: 100px;
- margin-bottom: 10px;
- padding: 10px;
- border: 1px solid #ccc;
- border-radius: 5px;
- }
- .send-button {
- width: 100%;
- padding: 10px;
- background-color: #007bff;
- color: #fff;
- border: none;
- border-radius: 5px;
- cursor: pointer;
- }
- .send-button:hover {
- background-color: #0056b3;
- }
- .chat-log {
- height: 200px;
- overflow-y: auto;
- margin-bottom: 10px;
- border: 1px solid #ccc;
- padding: 10px;
- border-radius: 5px;
- background-color: #f9f9f9;
- }
- .chat-log p {
- margin: 0;
- }
- </style>
- </head>
- <body>
- <div class="chat-container">
- <h2>Chat</h2>
- <div class="chat-log" id="chat-log"></div>
- <textarea class="message-box" id="message-box" placeholder="Type your message here..."></textarea>
- <button class="send-button" onclick="sendMessage()">Send</button>
- </div>
- <script>
- const chatLog = document.getElementById('chat-log');
- const messageBox = document.getElementById('message-box');
- function sendMessage() {
- const message = messageBox.value;
- if (message.trim() !== '') {
- // Display the message in the chat log
- const userMessage = document.createElement('p');
- userMessage.textContent = 'You: ' + message;
- chatLog.appendChild(userMessage);
- // Send the message to the Flipper Zero (this part needs to be implemented)
- console.log('Message sent:', message);
- // Clear the message box
- messageBox.value = '';
- // Simulate receiving a response from the Flipper Zero
- setTimeout(() => {
- const flipperResponse = document.createElement('p');
- flipperResponse.textContent = 'Flipper: ' + 'Response to "' + message + '"';
- chatLog.appendChild(flipperResponse);
- }, 1000);
- }
- }
- // Function to receive messages from the Flipper Zero
- function receiveMessage(message) {
- const flipperResponse = document.createElement('p');
- flipperResponse.textContent = 'Flipper: ' + message;
- chatLog.appendChild(flipperResponse);
- }
- // Example of receiving a message (this part needs to be replaced with actual implementation)
- setTimeout(() => {
- receiveMessage('Hello from Flipper Zero!');
- }, 2000);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement