stream-overlay/cmd/m3r1-chat/chat.html
2025-02-26 14:58:43 -08:00

47 lines
No EOL
1.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minecraft Twitch Chat Overlay</title>
<style>
body {
background-color: transparent;
color: white;
font-family: 'Minecraft', sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
overflow: hidden;
}
#chat {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 30%;
padding: 10px;
box-sizing: border-box;
background-color: rgba(0, 0, 0, 0.5);
overflow-y: auto;
}
.message {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div id="chat"></div>
<script>
async function fetchChat() {
const response = await fetch('/chat');
const data = await response.json();
const chat = document.getElementById('chat');
chat.innerHTML = data.messages.map(msg => `<div class="message">${msg}</div>`).join('');
chat.scrollTop = chat.scrollHeight;
}
setInterval(fetchChat, 1000);
</script>
</body>
</html>