Update handling of auto replay button.

This commit is contained in:
yukirij 2024-11-25 21:52:22 -08:00
parent cbb22e2b88
commit ce804a5c51
2 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,4 @@
span.text-system{color:#909090;} span.text-system{color:#909090;}
span.active{color:#d0b040;}
span.c_dawn{color:#ffe082;} span.c_dawn{color:#ffe082;}
span.c_dusk{color:#f6a1bd;} span.c_dusk{color:#f6a1bd;}
span.bold{font-weight:bold;} span.bold{font-weight:bold;}
@ -8,6 +7,9 @@ button.warn {
background-color:#471414; background-color:#471414;
color:#e0e0e0; color:#e0e0e0;
} }
button.active{
color:#d0b040;
}
span.monospace {font-family:monospace;} span.monospace {font-family:monospace;}

View File

@ -437,12 +437,7 @@ const INTERFACE = {
document.getElementById("indicator-turn").innerText = INTERFACE_DATA.Replay.turn + " / " + INTERFACE_DATA.Game.history.length; 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); document.getElementById("turn-slider").setAttribute("max", INTERFACE_DATA.Game.history.length);
let b_auto = document.getElementById("button-auto"); this.replay_update_button();
if(INTERFACE_DATA.Replay.auto) {
b_auto.setAttribute("class", "active");
} else {
b_auto.removeAttribute("class");
}
} break; } break;
} }
@ -1675,11 +1670,22 @@ const INTERFACE = {
INTERFACE_DATA.Replay.auto = false; INTERFACE_DATA.Replay.auto = false;
} }
} }
this.replay_update_button();
}, },
replay_off() { replay_off() {
INTERFACE_DATA.Replay.auto = false; 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() { auto() {
let bit = 1 << (INTERFACE_DATA.rotate ^ 1); let bit = 1 << (INTERFACE_DATA.rotate ^ 1);