From 1b85dea2be3056866366c77bc027b8924d17c010 Mon Sep 17 00:00:00 2001 From: Not-A-Normal-Robot Date: Sun, 28 Apr 2024 21:22:50 +0700 Subject: [PATCH] try to add tag filtering --- .github/scripts/generate_faq_html.py | 10 +++++++++- data/faq-template.html | 4 +--- style.css | 26 +++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/scripts/generate_faq_html.py b/.github/scripts/generate_faq_html.py index 95c049f..96a3eb5 100644 --- a/.github/scripts/generate_faq_html.py +++ b/.github/scripts/generate_faq_html.py @@ -47,9 +47,17 @@ def tags_html(entry): tags_html += tags_map[tag] return tags_html +def tags_in_class(entry): + tags = entry['tags'] + tags_classes = "" + for tag in tags: + if tag in tags_map: + tags_classes += tag + " " + return tags_classes + def faq_html(entry): return f""" -
+
{entry['question']} diff --git a/data/faq-template.html b/data/faq-template.html index ffe858f..d137f4d 100644 --- a/data/faq-template.html +++ b/data/faq-template.html @@ -46,9 +46,7 @@

Sourced from Techmino's official Discord server.
- Click on a question to reveal the answer.
- Use Ctrl+F to search for a question.
- Or if you're on mobile, use your browser's "find in page" feature. + Use your browser's "find in page" feature (Ctrl+F) to search for keywords.


diff --git a/style.css b/style.css index f29a398..bef99fb 100644 --- a/style.css +++ b/style.css @@ -199,6 +199,29 @@ details.question > summary::marker { --tag-logo: "󰂖"; /* console icon */ } /* #endregion */ +/* #region Question tag filters */ +.faq.show-techmino details.question:not(.techmino), +.faq.show-galaxy details.question:not(.galaxy), +.faq.show-linux details.question:not(.linux), +.faq.show-apple details.question:not(.apple), +.faq.show-multiplayer details.question:not(.multiplayer), +.faq.show-error details.question:not(.error), +.faq.show-bot details.question:not(.bot) +{ + display: none; +} + +.faq.hide-techmino details.question.techmino, +.faq.hide-galaxy details.question.galaxy, +.faq.hide-linux details.question.linux, +.faq.hide-apple details.question.apple, +.faq.hide-multiplayer details.question.multiplayer, +.faq.hide-error details.question.error, +.faq.hide-bot details.question.bot +{ + display: none; +} +/* #end */ details.question[open] > summary { border-bottom: 1px solid lime; @@ -207,9 +230,6 @@ details.question[open] > summary { details.question[open] article { padding: 0.5rem 1rem; } -details.question[open] { - display: block; -} details.question[open] img { max-width: 100%; height: auto;