From e173042f8c5c8e308a751f1caceec9c10469da29 Mon Sep 17 00:00:00 2001 From: sD Date: Mon, 1 Jun 2020 18:35:11 +0200 Subject: autoscroll so long messages aren't cut off --- webAO/client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'webAO/client.js') 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; -- cgit