34 lines
1.2 KiB
HTML
34 lines
1.2 KiB
HTML
<!-- index.html — Chatter Custom Channel -->
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body { font-family: sans-serif; padding: 20px; background: #0d0d12; color: #f0f0f5; margin: 0; }
|
|
h2 { color: #d64d7f; }
|
|
#feed { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
|
|
.msg { background: #1a1a25; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
|
|
.msg strong { color: #d64d7f; margin-right: 6px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>🔴 Live Feed</h2>
|
|
<p>User: <span id="who"></span></p>
|
|
<div id="feed"></div>
|
|
<script>
|
|
// Wait for Chatter to inject globals (slight delay after iframe loads)
|
|
setTimeout(function() {
|
|
var feed = document.getElementById('feed');
|
|
document.getElementById('who').textContent = chickenUser || '(unknown)';
|
|
|
|
// Listen to live public messages via the shared socket
|
|
chickenAPI.on('message', function(data) {
|
|
var el = document.createElement('div');
|
|
el.className = 'msg';
|
|
el.innerHTML = '<strong>' + data.username + '</strong>' + data.text;
|
|
feed.prepend(el);
|
|
if (feed.children.length > 50) feed.lastChild.remove();
|
|
});
|
|
}, 600);
|
|
</script>
|
|
</body></html> |