From d6efeb82bd6c8a0a4b203d11641240adc7b3eded Mon Sep 17 00:00:00 2001 From: Karthik <32044378+Karthik99999@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:13:17 -0700 Subject: [PATCH] Fix speed buttons on downloaded replays (#2162) --- js/replay-embed.template.js | 24 +++++++++++++++++------- replays/battle.php | 2 +- src/battle-log.ts | 3 --- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/js/replay-embed.template.js b/js/replay-embed.template.js index 4a896900a3..74ea797446 100644 --- a/js/replay-embed.template.js +++ b/js/replay-embed.template.js @@ -81,7 +81,7 @@ var Replays = { paused: true, }); - this.$('.replay-controls-2').html('
Speed:
Color scheme:
'); + this.$('.replay-controls-2').html('
Speed:
Color scheme:
'); // this works around a WebKit/Blink bug relating to float layout var rc2 = this.$('.replay-controls-2')[0]; @@ -138,13 +138,23 @@ var Replays = { break; case 'speed': - var speedTable = { - fast: 8, - normal: 800, - slow: 2500, - reallyslow: 5000 + var fadeTable = { + hyperfast: 40, + fast: 50, + normal: 300, + slow: 500, + reallyslow: 1000 }; - this.battle.messageDelay = speedTable[value]; + var delayTable = { + hyperfast: 1, + fast: 1, + normal: 1, + slow: 1000, + reallyslow: 3000 + }; + this.battle.messageShownTime = delayTable[value]; + this.battle.messageFadeTime = fadeTable[value]; + this.battle.scene.updateAcceleration(); break; } }, diff --git a/replays/battle.php b/replays/battle.php index d369f72d70..6e7e0b0c1c 100644 --- a/replays/battle.php +++ b/replays/battle.php @@ -113,7 +113,7 @@ function userid($username) {
Speed: -
+
Color scheme: diff --git a/src/battle-log.ts b/src/battle-log.ts index 31decf131b..99dffa486d 100644 --- a/src/battle-log.ts +++ b/src/battle-log.ts @@ -1161,9 +1161,6 @@ export class BattleLog { buf += '\n'; buf += '\n'; buf += `${BattleLog.escapeHTML(battle.tier)} replay: ${BattleLog.escapeHTML(battle.p1.name)} vs. ${BattleLog.escapeHTML(battle.p2.name)}\n`; - buf += '\n'; buf += '
\n'; buf += '\n'; buf += '
\n';