$(document).ready(function() {
function encode(r){return r.replace(/[\x26\x0A\<>'"]/g,function(r){return""+r.charCodeAt(0)+";"})}
$.getJSON("/api", function(data) {
$(".main-stats").append('
Public Players
' + data.public_players_count + '
');
$(".main-stats").append('
Private Players
' + data.private_players_count + '
');
$(".main-stats").append('
Total Players
' + data.total_players_count + '
');
$(".main-stats").append('');
$(".main-stats").append('
Public Games
' + data.public_games_count + '
');
$(".main-stats").append('
Private Games
' + data.private_games_count + '
');
$(".main-stats").append('
Total Games
' + data.total_games_count + '
');
$(".main-stats").append('');
$(".main-stats").append('
In Connection
' + data.in_progress_count + '
');
$(".main-stats").append('
On Proxy Server
' + data.master_proxy_count + '
');
});
$.getJSON("/api/public_games", function(data) {
$.each(data, function() {
$(".games-table").append(' ' + this.game_name + ' (' + this.title_id + ') | ' + this.player_count + '/' + this.max_player_count + ' ' + this.players.map(player => encode(player)).join(', ') + ' | ' + this.mode + ' (' + this.status + ') |
');
});
});
});