[c] update default file

This commit is contained in:
Sangelo 2024-06-12 13:24:35 +02:00
parent 2349d92b5f
commit 64b6d16e3a

View file

@ -6,7 +6,7 @@
let mods = { mods: [], optional_mods: [] };
let timeout;
let searchQuery = "";
let selectedFile = "modlist-rekindled.json";
let selectedFile = "modlist-marbled.json";
let fileList = [];
let loading = true;
@ -47,7 +47,7 @@
loading = false;
});
function fuzzySearch(query, mods) {
function search(query, mods) {
const regex = new RegExp(query, "i");
return mods.filter(
(mod) => regex.test(mod.name) || regex.test(mod.description),
@ -90,12 +90,12 @@
{#if loading}
<p>Loading...</p>
{:else if fuzzySearch(searchQuery, mods.mods).length === 0 && fuzzySearch(searchQuery, mods.optional_mods).length === 0}
{:else if search(searchQuery, mods.mods).length === 0 && search(searchQuery, mods.optional_mods).length === 0}
<p>⚠️ No results found.</p>
{:else}
<div class="grid" id="mods">
{#each Array(Math.ceil(fuzzySearch(searchQuery, mods.mods).length / 3)) as _, index}
{#each fuzzySearch(searchQuery, mods.mods).slice(index * 3, (index + 1) * 3) as mod}
{#each Array(Math.ceil(search(searchQuery, mods.mods).length / 3)) as _, index}
{#each search(searchQuery, mods.mods).slice(index * 3, (index + 1) * 3) as mod}
<a
role="button"
class="mod-card card contrast"
@ -117,8 +117,8 @@
<!-- svelte-ignore a11y-no-redundant-roles -->
<summary role="button" class="secondary">Optional Mods</summary>
<div class="grid" id="optional-mods">
{#each Array(Math.ceil(fuzzySearch(searchQuery, mods.optional_mods).length / 3)) as _, index}
{#each fuzzySearch(searchQuery, mods.optional_mods).slice(index * 3, (index + 1) * 3) as mod}
{#each Array(Math.ceil(search(searchQuery, mods.optional_mods).length / 3)) as _, index}
{#each search(searchQuery, mods.optional_mods).slice(index * 3, (index + 1) * 3) as mod}
<a
role="button"
class="mod-card card contrast"