diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2018-05-23 00:09:13 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2018-05-23 00:09:13 -0500 |
| commit | 334ee0e9feebe15926e5ad9a967c24cdf5264cdb (patch) | |
| tree | 8db3115d3b0a78dc72d6186b750c189efbfb5276 /webAO/client.js | |
| parent | 8f61192332b56379bc424dba6d5662d682cda379 (diff) | |
New client build, with GoldenLayout included
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/webAO/client.js b/webAO/client.js index 89baeff..6d301e5 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -19,7 +19,7 @@ const MUSIC_HOST = AO_HOST + "sounds/music/"; const BAR_WIDTH = 90; const BAR_HEIGHT = 20; const CHAR_SELECT_WIDTH = 8; -const UPDATE_INTERVAL = 100; +const UPDATE_INTERVAL = 65; let oldLoading = false; if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) { @@ -224,7 +224,11 @@ class Client { } cleanup() { - this.serv.close(1001); + try { + this.serv.close(1001); + } catch (e) { + // I don't care if this errors + } clearInterval(this.checkUpdater); } @@ -279,7 +283,11 @@ class Client { * @param {Array} args packet arguments */ handleCT(args) { - document.getElementById("client_ooclog").innerHTML = document.getElementById("client_ooclog").innerHTML + args[1] + ": " + args[2] + "\r\n"; + const oocLog = document.getElementById("client_ooclog"); + oocLog.innerHTML += `${args[1]}: ${args[2]}\r\n`; + if (oocLog.scrollTop > oocLog.scrollHeight - 60) { + oocLog.scrollTop = oocLog.scrollHeight; + } } /** @@ -589,6 +597,16 @@ class Viewport { this.shoutTimer = 0; this.textTimer = 0; + + this._animating = false; + } + + /** + * Returns whether or not the viewport is busy + * performing a task (animating). + */ + isAnimating() { + return this._animating; } /** @@ -619,6 +637,7 @@ class Viewport { this.textnow = ''; this.sfxplayed = 0; this.textTimer = 0; + this._animating = true; this.updater = setInterval(() => this.updateText(), UPDATE_INTERVAL); } @@ -687,6 +706,7 @@ class Viewport { document.getElementById("client_inner_chat").innerHTML = this.textnow; if (this.textnow == this.chatmsg.content) { this.textTimer = 0; + this._animating = false; clearInterval(this.updater); document.getElementById("client_char").src = AO_HOST + "characters/" + escape(this.chatmsg.name) + "/" + this.chatmsg.silent + ".gif"; } |
