From 32fb8be8fe78b467f9f6b53c6640daf7f0f9e64b Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 12 Oct 2021 02:23:33 +0100 Subject: [PATCH] docs: remember searchall setting with localStorage; better categorical command list filtering --- .docs/Reference.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.docs/Reference.html b/.docs/Reference.html index bf10399..2cfefcc 100644 --- a/.docs/Reference.html +++ b/.docs/Reference.html @@ -14,11 +14,11 @@
- - + +
- +
@@ -128,6 +128,7 @@ function do_filter() { let el_search = document.querySelector("#input-filter"); let el_searchall = document.querySelector("#input-searchall"); + localStorage.setItem("commandlist-searchall", el_searchall.checked); /* Filterable items - Sections - Commands in the command list @@ -165,6 +166,22 @@ el_next.classList.remove("visible", "hidden"); el_next.classList.add(show ? "visible" : "hidden"); } + + let commandlist_is_categorical = document.querySelector("button.active[data-mode=categorical]") !== null; + if(commandlist_is_categorical) { + let container = document.querySelector(".command-container"); + for(let i = 0; i < container.children.length; i++) { + if(container.children[i].nodeName.toLowerCase() === "ul") { + let class_name = "visible"; + if(container.children[i].querySelector("li.visible") === null) + class_name = "hidden"; + if(i > 0) { + container.children[i-1].classList.remove("visible", "hidden"); + container.children[i-1].classList.add(class_name); + } + } + } + } } window.addEventListener("load", (_event) => { @@ -181,6 +198,9 @@ els_cats[i].addEventListener("touchend", handle_display_mode); } + if(localStorage.getItem("commandlist-searchall") !== null) + el_searchall.checked = localStorage.getItem("commandlist-searchall") === "true"; + if(localStorage.getItem("commandlist-displaymode") !== null) set_display_mode(localStorage.getItem("commandlist-displaymode")) });