Update index.html

This commit is contained in:
2026-04-10 09:50:36 -04:00
parent 361308cc1f
commit bb7453d77e

View File

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