Untitled

Anonymous
Plain Text
10/15/2025 1:45 PM
2.8 KB
15
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>🌷 My Cute Chat</title>
<style>
  body {
    font-family: "Poppins", sans-serif;
    background: linear-gradient(180deg, #ffe8f0, #e3f2ff);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  header {
    background: #ffb6c1;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    font-size: 1.3em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  #chat {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
  }
  .message {
    background: white;
    border-radius: 15px;
    padding: 8px 12px;
    margin: 10px 0;
    max-width: 80%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    word-wrap: break-word;
  }
  .mine {
    background: #cce5ff;
    align-self: flex-end;
  }
  #input-area {
    display: flex;
    padding: 8px;
    background: white;
    border-top: 1px solid #eee;
  }
  #input {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 20px;
    background: #f8f8f8;
  }
  button {
    background: #ffb6c1;
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 5px;
    font-size: 18px;
  }
  input[type=file] {
    display: none;
  }
  .media {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 5px;
  }
</style>
</head>
<body>
<header>🌷 My Cute Chat 🌷</header>

<div id="chat"></div>

<div id="input-area">
  <input id="input" placeholder="Type a message..." />
  <label for="fileInput">
    <button>📎</button>
  </label>
  <input type="file" id="fileInput" accept="image/*,video/*">
  <button id="sendBtn">➤</button>
</div>

<script>
  const chat = document.getElementById('chat');
  const input = document.getElementById('input');
  const sendBtn = document.getElementById('sendBtn');
  const fileInput = document.getElementById('fileInput');

  function addMessage(content, isMine = true) {
    const msg = document.createElement('div');
    msg.className = 'message' + (isMine ? ' mine' : '');
    msg.innerHTML = content;
    chat.appendChild(msg);
    chat.scrollTop = chat.scrollHeight;
  }

  sendBtn.onclick = () => {
    const text = input.value.trim();
    if (text) {
      addMessage(text);
      input.value = '';
    }
  };

  fileInput.onchange = e => {
    const file = e.target.files[0];
    if (!file) return;
    const url = URL.createObjectURL(file);
    let content = '';
    if (file.type.startsWith('image')) {
      content = `<img src="${url}" class="media">`;
    } else if (file.type.startsWith('video')) {
      content = `<video controls class="media"><source src="${url}"></video>`;
    }
    addMessage(content);
  };
</script>

</body>
</html>
Editor is loading...
Leave a Comment