blob: fb65ce1700f53adb3e4578f343d451bae7ea0c08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<!DOCTYPE html>
<html>
<head>
<title>chat widget</title>
<link rel="stylesheet" href="/style.css">
</head>
<body class="messages" id="messages">
<noscript>
JavaScript is required.
</noscript>
</body>
<script src="/scripts/chat.js"></script>
<script src="/scripts/badges.js"></script>
<script>
let user = null;
const params = {};
const badges = {};
window.addEventListener("load", () => {
for (const [k, v] of new URLSearchParams(window.location.search)) {
params[k] = v;
}
if (!("channel" in params)) {
addSystemMessage("No channel specified!");
return;
}
fetch(`https://api.ivr.fi/v2/twitch/user?login=${params["channel"]}`)
.then((r) => r.json())
.then((json) => {
if (json.length == 0) {
addSystemMessage(`Channel #${params["channel"]} does not exist.`);
return;
}
user = json[0];
connectToChat("wss://irc-ws.chat.twitch.tv", "justinfan12345", "65432", user["login"]);
getTwitchBadges(user["login"], badges);
});
});
</script>
</html>
|