summaryrefslogtreecommitdiff
path: root/twitch.html
blob: 65b94871f2d4fe6e0d96966c42b15803c7eae762 (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
<!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>
        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;
            }
            
            connectToChat("wss://irc-ws.chat.twitch.tv", "justinfan12345", "65432", params["channel"]);
            getTwitchBadges(params["channel"], badges);
        });
    </script>
</html>