Skip to content

Commit

Permalink
Fix game filter URL not updating when picking default value
Browse files Browse the repository at this point in the history
  • Loading branch information
Tina-otoge committed Sep 5, 2024
1 parent a150904 commit 81dac4f
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions app/templates/games.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,13 @@
function filterPlatforms() {
let value = platform.value || 'Arcade';
if (value == 'all')
return;
games.forEach(game => {
const platforms = game.dataset.platforms.split(',');
if (!platforms.includes(value))
game.style.display = 'none';
});
if (value != 'all') {
games.forEach(game => {
const platforms = game.dataset.platforms.split(',');
if (!platforms.includes(value))
game.style.display = 'none';
});
}
isDefaultPlatform = value == 'Arcade';
Expand All @@ -373,14 +372,13 @@
function filterNames() {
const value = name.value.toLowerCase();
if (!value)
return;
games.forEach(game => {
const gameName = game.dataset.name.toLowerCase();
if (!(gameName.includes(value) || game.dataset.slug.includes(value)))
game.style.display = 'none';
});
if (value) {
games.forEach(game => {
const gameName = game.dataset.name.toLowerCase();
if (!(gameName.includes(value) || game.dataset.slug.includes(value)))
game.style.display = 'none';
});
}
const url = new URL(window.location);
url.searchParams.set('name', value);
Expand Down

0 comments on commit 81dac4f

Please sign in to comment.