aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2020-06-01 18:35:11 +0200
committersD <stoned@derpymail.org>2020-06-01 18:35:11 +0200
commite173042f8c5c8e308a751f1caceec9c10469da29 (patch)
tree0028207439b1a98fbc6c2d9ce928fa1851b9a3e2 /webAO/client.js
parentd333a6c3b163d74c62009a36e74f0061416f1862 (diff)
autoscroll so long messages aren't cut off
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 9207a1a..ff1774b 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1789,7 +1789,8 @@ async changeBackground(position) {
const pairSprite = document.getElementById("client_pair_char");
const eviBox = document.getElementById("client_evi");
const shoutSprite = document.getElementById("client_shout");
- const chatBoxInner = document.getElementById("client_inner_chat");
+ const chatBoxInner = document.getElementById("client_inner_chat");
+ const chatBox = document.getElementById("client_chat");
// TODO: preanims sometimes play when they're not supposed to
if (this.textTimer >= this.shoutTimer && this.chatmsg.startpreanim) {
@@ -1898,6 +1899,9 @@ async changeBackground(position) {
chatBoxInner.innerText = this.textnow;
+ // scroll to bottom
+ chatBox.scrollTop = chatBox.scrollHeight;
+
if (this.textnow === this.chatmsg.content) {
this._animating = false;
charSprite.src = this.silentSprite;