summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-10-27 00:06:35 +0500
committerilotterytea <iltsu@alright.party>2025-10-27 00:06:35 +0500
commitafd99384d0ca224907901a92a87963663559589d (patch)
tree98577634eecc10994820fd54e82640e0f5892ec9
parent94e74ac79e775253b56384748c619a764d31e091 (diff)
feat: generate twitch chat via form
-rw-r--r--index.html67
-rw-r--r--style.css18
-rw-r--r--twitch.html20
3 files changed, 99 insertions, 6 deletions
diff --git a/index.html b/index.html
index e69de29..32f47d7 100644
--- a/index.html
+++ b/index.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>ilotterytea&apos;s chat widget</title>
+ <link rel="stylesheet" href="/style.css">
+ </head>
+ <body class="center">
+ <h1><img src="/logo.png" alt> ilotterytea&apos;s chat widget</h1>
+ <p>a simple, client-side, lightweight Twitch chat for your streams.</p>
+ <form action="/twitch.html" method="get">
+ <div>
+ <label for="channel">Channel name:</label>
+ <input type="text" name="channel" id="channel"
+ placeholder="forsen">
+ </div>
+ <div>
+ <label for="fetchrecentmessages">Fetch recent messages:</label>
+ <input type="checkbox" name="fetchrecentmessages"
+ id="fetchrecentmessages"
+ value="1">
+ </div>
+ <div>
+ <label for="thirdpartyemotes">Enable Third-party emotes
+ <i>&lpar;FFZ, BTTV, 7TV, TinyEmotes&rpar;</i>:</label>
+ <input type="checkbox" name="thirdpartyemotes"
+ id="thirdpartyemotes"
+ value="1" checked>
+ </div>
+ <div>
+ <label for="membership">Show joined/parted chatters:</label>
+ <input type="checkbox" name="membership" id="membership"
+ value="1">
+ </div>
+ <details>
+ <summary>More...</summary>
+
+ <div>
+ <label for="ircserver">IRC server:</label>
+ <input type="url" name="ircserver" id="ircserver"
+ placeholder="wss://irc-ws.chat.twitch.tv">
+ </div>
+
+ <div>
+ <label for="ircuser">IRC username:</label>
+ <input type="name" name="ircuser" id="ircuser"
+ placeholder="justinfan12345">
+ </div>
+
+ <div>
+ <label for="ircpass">IRC password:</label>
+ <input type="password" name="ircpass" id="ircpass"
+ placeholder="65432">
+ </div>
+
+ <div>
+ <label for="tinyemotesinstances">TinyEmotes
+ instances:</label>
+ <textarea name="tinyemotesinstances"
+ id="tinyemotesinstances"
+ placeholder="1 URL per line"></textarea>
+ </div>
+
+ </details>
+ <button type="submit">Generate</button>
+ </form>
+ </body>
+</html> \ No newline at end of file
diff --git a/style.css b/style.css
index 9776355..24e9519 100644
--- a/style.css
+++ b/style.css
@@ -10,6 +10,23 @@
margin: 0;
}
+body {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+form div {
+ display: block;
+}
+
+.center {
+ width: 35em;
+ margin: 0 auto;
+}
+
+.center>* {
+ margin-bottom: 16px;
+}
+
.messages {
display: flex;
flex-direction: column;
@@ -20,7 +37,6 @@
text-shadow: 1px 1px 2px var(--message-shadow-color);
padding: 4px;
border-bottom: 1px solid var(--message-shadow-color);
- font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: gray;
}
diff --git a/twitch.html b/twitch.html
index 504c752..109c676 100644
--- a/twitch.html
+++ b/twitch.html
@@ -16,15 +16,23 @@
<script>
let user = null;
const params = {
+ "ircserver": "wss://irc-ws.chat.twitch.tv",
+ "ircuser": "justinfan12345",
+ "ircpass": "65432",
"channel": null,
"tinyemotesinstances": null,
- "fetchrecentmessages": null
+ "fetchrecentmessages": null,
+ "membership": null,
+ "thirdpartyemotes": null
};
const badges = {};
const emotes = {};
window.addEventListener("load", () => {
for (const [k, v] of new URLSearchParams(window.location.search)) {
+ if (v.trim().length == 0) {
+ continue;
+ }
params[k] = v;
}
@@ -47,7 +55,7 @@
getRecentMessages(user["login"]);
}
- connectToChat("wss://irc-ws.chat.twitch.tv", "justinfan12345", "65432", user["login"]);
+ connectToChat(params.ircserver, params.ircuser, params.ircpass, user["login"]);
getTwitchBadges(user["login"], badges);
// adding emotes
@@ -67,9 +75,11 @@
}
}
- emotePromises
- .reduce((p, fn) => p.then(fn), Promise.resolve())
- .then(() => addSystemMessage("All emotes loaded"));
+ if (params.thirdpartyemotes) {
+ emotePromises
+ .reduce((p, fn) => p.then(fn), Promise.resolve())
+ .then(() => addSystemMessage("All emotes loaded"));
+ }
});
});
</script>