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.game_name + ' ' + this.title_id + ' v' + this.title_version + '
' - + '
' + this.player_count + '/' + this.max_player_count + ' Players
' - + '
' + this.players.map(player => encode(player)).join(', ') - + '
'); + + '
' + this.player_count + '/' + this.max_player_count + ' Players
' + + '
' + this.players.map(player => encode(player)).join(', ') + + '
'); }); }); -}); \ No newline at end of file +});