From 4518ae6f35e907b4a08b741f2b2b8cdb94283f31 Mon Sep 17 00:00:00 2001 From: sD Date: Tue, 7 Apr 2020 18:04:26 +0200 Subject: clear the timeout first, then get the html elements --- webAO/client.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 632bf69..1a4d8db 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1516,27 +1516,19 @@ async changeBackground(position) { this.textTimer = 0; this._animating = true; - const charSprite = document.getElementById("client_char"); - const pairSprite = document.getElementById("client_pair_char"); - const nameBox = document.getElementById("client_name"); - const chatBox = document.getElementById("client_chat"); - const chatContainerBox = document.getElementById("client_chatcontainer"); - const waitingBox = document.getElementById("client_chatwaiting"); - const eviBox = document.getElementById("client_evi"); - const shoutSprite = document.getElementById("client_shout"); - const chatBoxInner = document.getElementById("client_inner_chat"); - const fg = document.getElementById("client_fg"); - const gamewindow = document.getElementById("client_gamewindow"); - - let gifLength = 0; - // stop updater clearTimeout(this.updater); + const fg = document.getElementById("client_fg"); + const gamewindow = document.getElementById("client_gamewindow"); + const waitingBox = document.getElementById("client_chatwaiting"); + // Reset CSS animation fg.style.animation = ""; gamewindow.style.animation = ""; waitingBox.innerText = ""; + + const eviBox = document.getElementById("client_evi"); if (this.lastEvi !== this.chatmsg.evidence) { eviBox.style.opacity = "0"; @@ -1544,6 +1536,14 @@ async changeBackground(position) { } this.lastEvi = this.chatmsg.evidence; + const charSprite = document.getElementById("client_char"); + const pairSprite = document.getElementById("client_pair_char"); + + const nameBox = document.getElementById("client_name"); + const chatBox = document.getElementById("client_chat"); + const chatContainerBox = document.getElementById("client_chatcontainer"); + const chatBoxInner = document.getElementById("client_inner_chat"); + //Clear out the last message chatBoxInner.innerText = this.textnow; nameBox.innerText = this.chatmsg.nameplate; @@ -1580,6 +1580,7 @@ async changeBackground(position) { } // gets which shout shall played + const shoutSprite = document.getElementById("client_shout"); const shout = this.shouts[this.chatmsg.objection]; if (shout) { // Hide message box @@ -1609,6 +1610,7 @@ async changeBackground(position) { } this.chatmsg.startpreanim = true; + let gifLength = 0; switch (this.chatmsg.type) { // case 0: // normal emote, no preanim -- cgit