aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2023-06-20 23:33:13 +0300
committerRblSb <msrblsb@gmail.com>2023-06-20 23:33:13 +0300
commitc476a16ad982e778580d74b8e4120ed29118129a (patch)
treec326895bc9eb57cf50123eadb049ec73b3a201f2 /src/client/Buttons.hx
parentcdf7f00f613d636e587b7840ec8b263017513486 (diff)
Scroll to chat end button
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