diff options
| author | sD <stoned@derpymail.org> | 2020-03-17 17:32:04 +0100 |
|---|---|---|
| committer | sD <stoned@derpymail.org> | 2020-03-17 17:32:04 +0100 |
| commit | aae898fc5753a688348eb9bea0a0062561a8e5cb (patch) | |
| tree | 0d6b91fd07653efcf29a6eb0b4d3ef41ecc08423 /webAO | |
| parent | d4f6f89b22a0cb84c85a3ace8f814a5e65189571 (diff) | |
catch the error if the browser doesn't support promises
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/client.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/webAO/client.js b/webAO/client.js index 5999bfe..291802e 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1363,19 +1363,25 @@ async changeBackground(position) { this.changeBackground(chatmsg.side); + try { const { url: speakUrl } = await this.oneSuccess([ this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + this.chatmsg.sprite + ".png")), this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/(b)" + this.chatmsg.sprite + ".gif")) ]); - this.speakingSprite = speakUrl ? speakUrl : transparentPNG; + } catch (error) { + this.speakingSprite = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/(b)" + this.chatmsg.sprite + ".gif"; + } + try { const { url: silentUrl } = await this.oneSuccess([ this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/" + this.chatmsg.sprite + ".png")), this.rejectOnError(fetch(AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/(a)" + this.chatmsg.sprite + ".gif")) ]); - this.silentSprite = silentUrl ? silentUrl : transparentPNG; + } catch (error) { + this.silentSprite = AO_HOST + "characters/" + encodeURI(this.chatmsg.name.toLowerCase()) + "/(a)" + this.chatmsg.sprite + ".gif"; + } // gets which shout shall played const shout = this.shouts[this.chatmsg.objection]; |
