Skip to content

Commit

Permalink
fix newline game bug
Browse files Browse the repository at this point in the history
  • Loading branch information
orn8 committed Jul 19, 2024
1 parent 49dec39 commit 12acb40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ document.addEventListener('DOMContentLoaded', function() {
.then(response => response.text())
.then(gamesString => {
const lines = gamesString.split('\n');
const filteredLines = lines.filter(line => !line.trim().startsWith('##'));
const filteredLines = lines.filter(line => line.trim() !== '' && !line.trim().startsWith('##'));
const filteredGamesString = filteredLines.join('\n');
setupButtons(filteredGamesString);
});
Expand All @@ -18,6 +18,7 @@ document.addEventListener('DOMContentLoaded', function() {
const [name, url] = line.split(';').map(part => part.trim());
return { name, url };
})
.filter(game => game.name && game.url)
.sort((a, b) => a.name.localeCompare(b.name));

const gamesHeading = document.querySelector('h1');
Expand Down

0 comments on commit 12acb40

Please sign in to comment.