khguide/public/scripts/kh2.js

30 lines
633 B
JavaScript

import {
kindFilter,
showOnlyTracked,
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 });