From 415a9b43ce14e79680a673b04029a85a70933e7c Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Fri, 9 Jun 2023 18:19:54 +0200 Subject: [PATCH] Rename json properties to match the current ones --- public/main.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/main.js b/public/main.js index 3a45810..1709365 100644 --- a/public/main.js +++ b/public/main.js @@ -1,25 +1,25 @@ -$(document).ready(function() { - function encode(r){return r.replace(/[\x26\x0A\<>'"]/g,function(r){return""+r.charCodeAt(0)+";"})} +$(document).ready(function () { + function encode(r) { return r.replace(/[\x26\x0A\<>'"]/g, function (r) { return "" + r.charCodeAt(0) + ";" }) } - $.getJSON("/api", function(data) { - $(".players-public").text(data.public_players_count); - $(".players-private").text(data.private_players_count); - $(".players-total").text(data.total_players_count); + $.getJSON("/api", function (data) { + $(".players-public").text(data.public_player_count); + $(".players-private").text(data.private_player_count); + $(".players-total").text(data.total_player_count); - $(".games-public").text(data.public_games_count); - $(".games-private").text(data.private_games_count); - $(".games-total").text(data.total_games_count); + $(".games-public").text(data.public_game_count); + $(".games-private").text(data.private_game_count); + $(".games-total").text(data.total_game_count); $(".in-progress-total").text(data.in_progress_count); $(".proxy-server-total").text(data.master_proxy_count); }); - $.getJSON("/api/public_games", function(data) { - $.each(data, function() { + $.getJSON("/api/public_games", function (data) { + $.each(data, function () { $(".public-games").append('
' + this.players.map(player => encode(player)).join(', ') - + '
' + this.players.map(player => encode(player)).join(', ') + + '