From 12acb40c91aa27af363cb67d87413bf8288bb77c Mon Sep 17 00:00:00 2001 From: oragne <119661802+orn8@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:47:31 +1000 Subject: [PATCH] fix newline game bug --- script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index ac041de..3baa0f4 100644 --- a/script.js +++ b/script.js @@ -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); }); @@ -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');