Skip to content

Commit

Permalink
Fix round end text not being set to null when round end text is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed Aug 20, 2024
1 parent 6e225fa commit ab733d8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ReplayBrowser/Pages/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,21 @@
let playerList = "";
if (data.roundEndPlayers == null || data.roundEndPlayers.length == 0) {
players.innerHTML = "<p class='card-text text-danger'>Replay is incomplete. No players available.</p>";
return;
} else {
// Sort the players so that antags are at the top
data.roundEndPlayers.sort((a, b) => {
if (a.antagPrototypes.length > 0 && b.antagPrototypes.length == 0) {
return -1;
} else if (a.antagPrototypes.length == 0 && b.antagPrototypes.length > 0) {
return 1;
}
return 0;
});
}
// Sort the players so that antags are at the top
data.roundEndPlayers.sort((a, b) => {
if (a.antagPrototypes.length > 0 && b.antagPrototypes.length == 0) {
return -1;
} else if (a.antagPrototypes.length == 0 && b.antagPrototypes.length > 0) {
return 1;
}
return 0;
});
if (!data.roundEndText || data.roundEndText.trim() == "") {
endTextElement.innerHTML = "No round end text available.";
return
} else {
const colorTagPattern = new RegExp("\\[color=(.*?)\\](.*?)\\[/color\\]", "g");
const colorTagReplacement = "<span style=\"color:$1\">$2</span>";
Expand Down

0 comments on commit ab733d8

Please sign in to comment.