diff --git a/main.js b/main.js index 77cd25d..3babb85 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,6 @@ $(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 + '
'); @@ -14,7 +16,7 @@ $(document).ready(function() { $.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.join(', ') + ' ' + this.mode + ' (' + this.status + ')'); + $(".games-table").append(' ' + this.game_name + '
(' + this.title_id + ')' + this.player_count + '/' + this.max_player_count + '
' + encode(this.players.join(', ')) + ' ' + this.mode + ' (' + this.status + ')'); }); }); }); \ No newline at end of file