From 2c60b23287753f3aa8899f824aeb30990739676c Mon Sep 17 00:00:00 2001 From: Wynd Date: Mon, 1 Jul 2024 18:24:37 +0300 Subject: [PATCH] Added placeholder text for the search box and a footer --- Cargo.toml | 2 +- index.html | 15 +++++++++++++-- src/main.rs | 1 + templates/components/search.html | 2 +- templates/layouts/base.html | 9 +++++++++ templates/pages/commands.html | 4 +++- 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e1d02ba..62fde75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "khguide" -version = "0.1.0" +version = "1.0.1" edition = "2021" [dependencies] diff --git a/index.html b/index.html index 0e608e5..ed33a35 100644 --- a/index.html +++ b/index.html @@ -8,10 +8,16 @@ color: #fff; } + footer { + text-align: center; + } + table { + width: 100%; text-align: center; vertical-align: middle; border-collapse: collapse; + margin-top: 10px; thead th { background-color: #252525; @@ -55,6 +61,7 @@ const searchFilter = document.getElementById("filter"); let filterHandler = debounce(() => filter()); searchFilter.addEventListener("keyup", filterHandler); + searchFilter.placeholder = "Search commands..."; const searchInputs = document.querySelectorAll( 'input[type="radio"][name="search"]', @@ -63,6 +70,7 @@ searchInputs.forEach(function (item, index) { item.addEventListener("input", function () { searchType = this.checked ? this.value : ""; + searchFilter.placeholder = "Search " + this.value + "..."; filter(); }); }); @@ -111,7 +119,7 @@ resetStyle(child, tds); if (search.length > 0) { - if (searchType === "result") { + if (searchType === "commands") { // Check for command name if (!tds[1].innerText.toLowerCase().includes(search)) { child.style.display = "none"; @@ -183,7 +191,7 @@ id="searchResult" name="search" autocomplete="off" - value="result" + value="commands" checked /> @@ -4133,5 +4141,8 @@ - 5%------- + \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c401902..0c067c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -131,6 +131,7 @@ struct CommandsTemplate { const ABILITIES_PATH: &str = "./input/abilities.json"; const FINISHERS_PATH: &str = "./input/finish-commands.json"; const COMMANDS_PATH: &str = "./input/commands.json"; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); fn main() { // Initialize tracing diff --git a/templates/components/search.html b/templates/components/search.html index 17873a7..1c2749d 100644 --- a/templates/components/search.html +++ b/templates/components/search.html @@ -5,7 +5,7 @@ id="searchResult" name="search" autocomplete="off" - value="result" + value="commands" checked /> diff --git a/templates/layouts/base.html b/templates/layouts/base.html index 0adac52..d5eb2fc 100644 --- a/templates/layouts/base.html +++ b/templates/layouts/base.html @@ -8,10 +8,16 @@ color: #fff; } + footer { + text-align: center; + } + table { + width: 100%; text-align: center; vertical-align: middle; border-collapse: collapse; + margin-top: 10px; thead th { background-color: #252525; @@ -53,5 +59,8 @@
{% block content %}{% endblock %}
+ diff --git a/templates/pages/commands.html b/templates/pages/commands.html index 4e22ab0..07302b3 100644 --- a/templates/pages/commands.html +++ b/templates/pages/commands.html @@ -12,6 +12,7 @@ const searchFilter = document.getElementById("filter"); let filterHandler = debounce(() => filter()); searchFilter.addEventListener("keyup", filterHandler); + searchFilter.placeholder = "Search commands..."; const searchInputs = document.querySelectorAll( 'input[type="radio"][name="search"]', @@ -20,6 +21,7 @@ searchInputs.forEach(function (item, index) { item.addEventListener("input", function () { searchType = this.checked ? this.value : ""; + searchFilter.placeholder = "Search " + this.value + "..."; filter(); }); }); @@ -68,7 +70,7 @@ resetStyle(child, tds); if (search.length > 0) { - if (searchType === "result") { + if (searchType === "commands") { // Check for command name if (!tds[1].innerText.toLowerCase().includes(search)) { child.style.display = "none";