Skip to content

Commit

Permalink
Games: fix redirects and bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MotorTruck1221 committed Dec 17, 2024
1 parent bdc196f commit fbb47c5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion config.example.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[buildOpts]
games = false
games = true

[server]
wisp = true
Expand Down
74 changes: 37 additions & 37 deletions src/pages/gs/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@ const images = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/games/*.{jpeg,jpg,png,gif,webp}'
);
---

{!GAMES_LINK && <Layout title="" redirect={{path: '/', interval: 0}}>}
{GAMES_LINK && <Layout title="">}
<Layout title="" redirect={!GAMES_LINK ? { path: '/', interval: 0 }: undefined}>
<div class="w-full h-full px-[15%]">
<div class="h-[80px] w-full p-0 flex self-center transition duration-200">
<div class="flex grow items-center justify-left">
<a aria-label="home" href="/" class="text-[30px] text-[--accent] mr-[20px]">
<Icon name="mdi:chevron-left" />
</a>
<input oninput="searchGames(this.value)" class="flex flex-grow h-[42px] text-[14px] border-none text-[--text-color] bg-inherit outline-none" placeholder="Search games" id="app-input"></input>
{GAMES_LINK &&
<div class="h-[80px] w-full p-0 flex self-center transition duration-200">
<div class="flex grow items-center justify-left">
<a aria-label="home" href="/" class="text-[30px] text-[--accent] mr-[20px]">
<Icon name="mdi:chevron-left" />
</a>
<input oninput="searchGames(this.value)" class="flex flex-grow h-[42px] text-[14px] border-none text-[--text-color] bg-inherit outline-none" placeholder="Search games" id="app-input"></input>
</div>
</div>
</div>
<div class="mt-[10px] pb-[60px] w-full grid justify-center md:justify-between gap-[20px] grid-cols-[repeat(2,60%)] md:grid-cols-[repeat(auto-fill,166px)]">
{games.map((game) => (
<a href={`/gs/${btoa(game.name)}?py=${game.proxy}&url=${btoa(game.url)}&bf=${btoa(game.baseFile)}`} data-name={game.name} class="transition-all hover:scale-105 h-[166px] w-[166px] rounded-[5px] border-transparent bg-cover cursor-pointer">
<Image loading="lazy" class="object-cover w-[166px] h-[166px] rounded-[5px]" src={images[game.img]()} alt={`${game.name}'s logo`} />
</a>
))}
</div>
<div class="mt-[10px] pb-[60px] w-full grid justify-center md:justify-between gap-[20px] grid-cols-[repeat(2,60%)] md:grid-cols-[repeat(auto-fill,166px)]">
{games.map((game) => (
<a href={`/gs/${btoa(game.name)}?py=${game.proxy}&url=${btoa(game.url)}&bf=${btoa(game.baseFile)}`} data-name={game.name} class="transition-all hover:scale-105 h-[166px] w-[166px] rounded-[5px] border-transparent bg-cover cursor-pointer">
<Image loading="lazy" class="object-cover w-[166px] h-[166px] rounded-[5px]" src={images[game.img]()} alt={`${game.name}'s logo`} />
</a>
))}
</div>
}
</div>
<script>
window.searchGames = function(val: string) {
let elements: NodeListOf<HTMLElement> = document.querySelectorAll('[data-name]');
let count = 0;
</Layout>
<script>
window.searchGames = function(val: string) {
let elements: NodeListOf<HTMLElement> = document.querySelectorAll('[data-name]');
let count = 0;
elements.forEach(node => {
if (node.dataset.name === undefined) {
return;
}
if (node.dataset.name.toLowerCase().includes(val.toLowerCase())) {
node.classList.remove('hidden');
count++
} else {
node.classList.add('hidden');
}
})
if (!count) {
elements.forEach(node => {
if (node.dataset.name === undefined) {
return;
}
if (node.dataset.name.toLowerCase().includes(val.toLowerCase())) {
node.classList.remove('hidden');
count++
} else {
node.classList.add('hidden');
}
node.classList.remove('hidden');
})
if (!count) {
elements.forEach(node => {
node.classList.remove('hidden');
})
}
}
</script>
</Layout>
}
</script>

0 comments on commit fbb47c5

Please sign in to comment.