Add button to stop refreshing page in room visualizer

This commit is contained in:
jvyden 2022-01-16 19:21:20 -05:00
commit 9109e98898
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -9,7 +9,22 @@
Model.Title = "Debug - Room Visualizer";
}
<meta http-equiv="refresh" content="5">
<script>
let shouldRefresh = true;
setTimeout(() => {
if (shouldRefresh) window.location.reload();
}, 5000);
function stopRefreshing() {
shouldRefresh = false;
console.log("Stopped refresh");
const stopRefreshButton = document.getElementById("stop-refresh-button");
stopRefreshButton.parentElement.removeChild(stopRefreshButton);
console.log("Removed stop refresh button");
}
</script>
<p>This page will automatically refresh every 5 seconds.</p>
<p>@RoomHelper.Rooms.Count rooms</p>
@ -22,6 +37,8 @@
<div class="ui red button">Nuke all rooms</div>
</a>
<button class="ui blue button" onclick="stopRefreshing()" id="stop-refresh-button">Stop refreshing</button>
<h2>Best rooms for each game version</h2>
@foreach (GameVersion version in Enum.GetValues<GameVersion>())
{