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") %}