aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Buttons.hx')
-rw-r--r--src/client/Buttons.hx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index aa7c1b2..7152a31 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -60,6 +60,25 @@ class Buttons {
}
}
+ final scrollToChatEndBtn = ge("#scroll-to-chat-end");
+ function scrollToChatEndBtnAnim():Void {
+ if (scrollToChatEndBtn.style.opacity == "0") return;
+ scrollToChatEndBtn.style.opacity = "0";
+ scrollToChatEndBtn.addEventListener("transitionend", e -> {
+ scrollToChatEndBtn.style.display = "none";
+ }, {once: true});
+ }
+ scrollToChatEndBtn.onclick = e -> {
+ main.scrollChatToEnd();
+ scrollToChatEndBtnAnim();
+ }
+ // hide scroll button when chat is scrolled to the end
+ final msgBuf = ge("#messagebuffer");
+ msgBuf.onscroll = e -> {
+ if (msgBuf.offsetHeight + msgBuf.scrollTop < msgBuf.scrollHeight - 1) return;
+ scrollToChatEndBtnAnim();
+ }
+
ge("#clearchatbtn").onclick = e -> {
if (main.isAdmin()) main.send({type: ClearChat});
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage