aboutsummaryrefslogtreecommitdiff
path: root/webAO
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2020-03-18 19:39:55 +0100
committersD <stoned@derpymail.org>2020-03-18 19:39:55 +0100
commit4f66814433a970efa7b174cf9819bf6db6f985bf (patch)
treedf4a86bedaac457d91ea612ae9fea6119e6b647e /webAO
parent2906ec5aa682a1bd10987f7b494401072ad95ad2 (diff)
move preanim delay out of the case block
Diffstat (limited to 'webAO')
-rw-r--r--webAO/client.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 4a42306..89c4b6d 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1327,8 +1327,7 @@ async changeBackground(position) {
* Intialize updater
* @param {number} animdelay the length of pre-animation
*/
- initUpdater(animdelay) {
- viewport.chatmsg.preanimdelay = parseInt(animdelay);
+ initUpdater() {
viewport.updater = setTimeout(() => viewport.tick(), UPDATE_INTERVAL);
}
@@ -1493,7 +1492,7 @@ async changeBackground(position) {
const fg = document.getElementById("client_fg");
const gamewindow = document.getElementById("client_gamewindow");
- let delay = 0;
+ let gifLength = 0;
// stop updater
clearTimeout(this.updater);
@@ -1584,8 +1583,7 @@ async changeBackground(position) {
chatBox.style.display = "none";
chatContainerBox.style.display = "none";
// If preanim existed then determine the length
- delay = await this.getAnimLength(`${AO_HOST}characters/${encodeURI(chatmsg.name.toLowerCase())}/${encodeURI(chatmsg.preanim)}.gif`);
- chatmsg.preanimdelay = delay;
+ gifLength = await this.getAnimLength(`${AO_HOST}characters/${encodeURI(chatmsg.name.toLowerCase())}/${encodeURI(chatmsg.preanim)}.gif`);
this.chatmsg.startspeaking = false;
break;
// case 5:
@@ -1596,6 +1594,7 @@ async changeBackground(position) {
this.chatmsg.startspeaking = true;
break;
}
+ this.chatmsg.preanimdelay = parseInt(gifLength);
this.changeBackground(chatmsg.side);
@@ -1615,7 +1614,7 @@ async changeBackground(position) {
}
}
- this.initUpdater(delay);
+ this.initUpdater();
}
/**