From ce804a5c51b672ce52a2c527f4844a485daf367f Mon Sep 17 00:00:00 2001 From: yukirij Date: Mon, 25 Nov 2024 21:52:22 -0800 Subject: [PATCH] Update handling of auto replay button. --- www/css/util.css | 4 +++- www/js/interface.js | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/www/css/util.css b/www/css/util.css index 8ce8029..ac2fbdd 100644 --- a/www/css/util.css +++ b/www/css/util.css @@ -1,5 +1,4 @@ span.text-system{color:#909090;} -span.active{color:#d0b040;} span.c_dawn{color:#ffe082;} span.c_dusk{color:#f6a1bd;} span.bold{font-weight:bold;} @@ -8,6 +7,9 @@ button.warn { background-color:#471414; color:#e0e0e0; } +button.active{ + color:#d0b040; +} span.monospace {font-family:monospace;} diff --git a/www/js/interface.js b/www/js/interface.js index ea7b731..73dd32d 100644 --- a/www/js/interface.js +++ b/www/js/interface.js @@ -437,12 +437,7 @@ const INTERFACE = { document.getElementById("indicator-turn").innerText = INTERFACE_DATA.Replay.turn + " / " + INTERFACE_DATA.Game.history.length; document.getElementById("turn-slider").setAttribute("max", INTERFACE_DATA.Game.history.length); - let b_auto = document.getElementById("button-auto"); - if(INTERFACE_DATA.Replay.auto) { - b_auto.setAttribute("class", "active"); - } else { - b_auto.removeAttribute("class"); - } + this.replay_update_button(); } break; } @@ -1675,11 +1670,22 @@ const INTERFACE = { INTERFACE_DATA.Replay.auto = false; } } + this.replay_update_button(); }, replay_off() { INTERFACE_DATA.Replay.auto = false; + this.replay_update_button(); + }, + replay_update_button() { + let b_auto = document.getElementById("button-auto"); + if(b_auto !== null) { + if(INTERFACE_DATA.Replay.auto) { + b_auto.setAttribute("class", "active"); + } else { + b_auto.removeAttribute("class"); + } + } }, - auto() { let bit = 1 << (INTERFACE_DATA.rotate ^ 1);