[c] update default file
This commit is contained in:
parent
2349d92b5f
commit
64b6d16e3a
1 changed files with 7 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
||||||
let mods = { mods: [], optional_mods: [] };
|
let mods = { mods: [], optional_mods: [] };
|
||||||
let timeout;
|
let timeout;
|
||||||
let searchQuery = "";
|
let searchQuery = "";
|
||||||
let selectedFile = "modlist-rekindled.json";
|
let selectedFile = "modlist-marbled.json";
|
||||||
let fileList = [];
|
let fileList = [];
|
||||||
let loading = true;
|
let loading = true;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
function fuzzySearch(query, mods) {
|
function search(query, mods) {
|
||||||
const regex = new RegExp(query, "i");
|
const regex = new RegExp(query, "i");
|
||||||
return mods.filter(
|
return mods.filter(
|
||||||
(mod) => regex.test(mod.name) || regex.test(mod.description),
|
(mod) => regex.test(mod.name) || regex.test(mod.description),
|
||||||
|
@ -90,12 +90,12 @@
|
||||||
|
|
||||||
{#if loading}
|
{#if loading}
|
||||||
<p>Loading...</p>
|
<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>
|
<p>⚠️ No results found.</p>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="grid" id="mods">
|
<div class="grid" id="mods">
|
||||||
{#each Array(Math.ceil(fuzzySearch(searchQuery, mods.mods).length / 3)) as _, index}
|
{#each Array(Math.ceil(search(searchQuery, mods.mods).length / 3)) as _, index}
|
||||||
{#each fuzzySearch(searchQuery, mods.mods).slice(index * 3, (index + 1) * 3) as mod}
|
{#each search(searchQuery, mods.mods).slice(index * 3, (index + 1) * 3) as mod}
|
||||||
<a
|
<a
|
||||||
role="button"
|
role="button"
|
||||||
class="mod-card card contrast"
|
class="mod-card card contrast"
|
||||||
|
@ -117,8 +117,8 @@
|
||||||
<!-- svelte-ignore a11y-no-redundant-roles -->
|
<!-- svelte-ignore a11y-no-redundant-roles -->
|
||||||
<summary role="button" class="secondary">Optional Mods</summary>
|
<summary role="button" class="secondary">Optional Mods</summary>
|
||||||
<div class="grid" id="optional-mods">
|
<div class="grid" id="optional-mods">
|
||||||
{#each Array(Math.ceil(fuzzySearch(searchQuery, mods.optional_mods).length / 3)) as _, index}
|
{#each Array(Math.ceil(search(searchQuery, mods.optional_mods).length / 3)) as _, index}
|
||||||
{#each fuzzySearch(searchQuery, mods.optional_mods).slice(index * 3, (index + 1) * 3) as mod}
|
{#each search(searchQuery, mods.optional_mods).slice(index * 3, (index + 1) * 3) as mod}
|
||||||
<a
|
<a
|
||||||
role="button"
|
role="button"
|
||||||
class="mod-card card contrast"
|
class="mod-card card contrast"
|
||||||
|
|
Loading…
Reference in a new issue