50 lines
1.7 KiB
HTML
50 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Hacker Green Overlay</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
background-color: transparent;
|
|
color: #0f0;
|
|
font-family: 'VT323', monospace;
|
|
font-size: 20px;
|
|
margin: 0;
|
|
padding: 10px;
|
|
overflow: hidden;
|
|
text-shadow: 0 0 5px #0f0;
|
|
}
|
|
.chat-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
}
|
|
.username {
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="chat-container" class="chat-container">
|
|
<!-- Messages will be injected here -->
|
|
</div>
|
|
|
|
<script>
|
|
const userId = window.location.pathname.split('/')[2];
|
|
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
const ws = new WebSocket(`${wsProtocol}//${window.location.host}/ws/${userId}`);
|
|
|
|
ws.onmessage = function(event) {
|
|
const messageData = JSON.parse(event.data);
|
|
const chatContainer = document.getElementById('chat-container');
|
|
const messageElement = document.createElement('div');
|
|
messageElement.innerHTML = `<span class="username">${messageData.author}:</span> ${messageData.text}`;
|
|
chatContainer.appendChild(messageElement);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |