From 630439bc48873a171c0a45966ec8445413d6542b Mon Sep 17 00:00:00 2001 From: Wynd Date: Wed, 25 Jun 2025 11:39:48 +0300 Subject: [PATCH] Added a justfile for ease of use --- justfile | 15 ++++++++++++ public/scripts/kh2.js | 24 +------------------ .../scripts/modules/common/mat-kind-filter.js | 22 +++++++++++++++++ templates/pages/index.html | 2 +- 4 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..722e4e3 --- /dev/null +++ b/justfile @@ -0,0 +1,15 @@ +set export +set quiet + +build: + mkdir -p ./out + rm -rf ./out/* + cargo run + cp -r ./public ./out/public + +test: + cargo test + +format: + cargo fix --allow-dirty --allow-staged + cargo fmt -- --emit=files diff --git a/public/scripts/kh2.js b/public/scripts/kh2.js index ec5c943..df5e1f4 100644 --- a/public/scripts/kh2.js +++ b/public/scripts/kh2.js @@ -4,26 +4,4 @@ import { track, } from "./modules/common/mat-kind-filter.js"; -function filter() { - const categories = document.querySelectorAll(".category-wrapper"); - - for (const category of categories) { - let isTracked = category.dataset["isTracked"] == "true"; - let kind = category.dataset["matKind"]; - let type = category.dataset["matType"]; - - category.style.display = ""; - - if (showOnlyTracked && !isTracked) { - category.style.display = "none"; - } - - if (kindFilter.size > 0) { - if (!kindFilter.has(kind)) { - category.style.display = "none"; - } - } - } -} - -Object.assign(window, { filter, track }); +Object.assign(window, { track }); diff --git a/public/scripts/modules/common/mat-kind-filter.js b/public/scripts/modules/common/mat-kind-filter.js index 65bd14d..44135e3 100644 --- a/public/scripts/modules/common/mat-kind-filter.js +++ b/public/scripts/modules/common/mat-kind-filter.js @@ -27,6 +27,28 @@ document.addEventListener("DOMContentLoaded", (event) => { }); }); +function filter() { + const categories = document.querySelectorAll(".category-wrapper"); + + for (const category of categories) { + let isTracked = category.dataset["isTracked"] == "true"; + let kind = category.dataset["matKind"]; + let type = category.dataset["matType"]; + + category.style.display = ""; + + if (showOnlyTracked && !isTracked) { + category.style.display = "none"; + } + + if (kindFilter.size > 0) { + if (!kindFilter.has(kind)) { + category.style.display = "none"; + } + } + } +} + export function track(element) { let parent = element.parentElement.parentElement; let isTracked = parent.dataset["isTracked"] ?? false; diff --git a/templates/pages/index.html b/templates/pages/index.html index ed22741..06fc051 100644 --- a/templates/pages/index.html +++ b/templates/pages/index.html @@ -30,7 +30,7 @@ {% if cfg!(feature = "kh2") %}

Kingdom Hearts II

{% endif %}