Skip to content

Commit

Permalink
Merge pull request #15 from EvanFellman/better_leaderboard
Browse files Browse the repository at this point in the history
improved leaderboard graphics
  • Loading branch information
EvanFellman authored Mar 18, 2021
2 parents f03cf37 + 72776b0 commit 323aa82
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions static/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,20 +618,28 @@ function lose(){
rightSection.appendChild(leaderboardTable);
const leaderboardBody = document.createElement("tbody");
const titleRow = document.createElement('tr');
titleRow.style.backgroundColor = 'darkgray';
titleRow.style.color = 'black'
leaderboardBody.appendChild(titleRow);
const rankTitle = document.createElement("td");
rankTitle.style.minWidth = "100px";
rankTitle.style.minWidth = "10px";
titleRow.appendChild(rankTitle);
const nameTitle = document.createElement("td");
nameTitle.innerHTML = "Name";
nameTitle.innerHTML = "<strong>Name</strong>";
titleRow.appendChild(nameTitle);
const scoreTitle = document.createElement("td");
scoreTitle.innerHTML = "Score";
scoreTitle.innerHTML = "<strong>Score</strong>";
titleRow.appendChild(scoreTitle);

leaderboardTable.appendChild(leaderboardBody);
for(let i = 0; i < data.length; i++){
const row = document.createElement('tr');
row.style.color = 'black';
if(i % 2 === 0){
row.style.backgroundColor = 'gray';
} else {
row.style.backgroundColor = 'lightgray';
}
leaderboardBody.appendChild(row);
const rankingTd = document.createElement('td');
rankingTd.innerHTML = `${i + 1}.`;
Expand Down

0 comments on commit 323aa82

Please sign in to comment.