commit e850812d39b183f4ce92a72279b4ffc99dfaf1ce
parent 725b337378e79fc6943d5bb5a6fbbe3d65306e3e
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Thu, 17 Oct 2024 22:12:28 +0200
feat: implement proper "Default" category
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/assets/css/custom.css b/assets/css/custom.css
@@ -79,9 +79,8 @@ article.selected {
}
/* Add Text-Marker for selected search engines */
-article.selected > h3 > a:after {
- font-size: 50%;
- content: "(Default)";
+article.selected > marker {
+ display: initial !important;
}
/* prevent wrapping within marks */
diff --git a/index.php b/index.php
@@ -201,13 +201,17 @@
<details id="categories">
<summary>Categories</summary>
<div class="row">
+ <!-- Always insert a "Default" category button -->
+ <button onclick="search_for_category('Default');">
+ #Default
+ </button>
<?php
foreach (array_keys($categories) as $catid) {
$cat_name = $categories[$catid]["name"];
?>
<button
- onclick="search_for_category('#<?php echo $cat_name; ?>');"
+ onclick="search_for_category('<?php echo $cat_name; ?>');"
>
<?php echo "#" . $cat_name; ?>
</button>
@@ -237,6 +241,9 @@
</a>
</h3>
<p><?php echo $search["description"]; ?></p>
+ <!-- Insert "Default" Marker for all search engines
+ Hide Default Marker initially -->
+ <mark style="display: none;">#Default</mark>
<?php
foreach ($search["categories"] as $catid) {
$cat_name = $categories[$catid]["name"];
@@ -460,7 +467,7 @@
<script>
search_for_category = function(category) {
// Insert category name into category-searchbar
- document.getElementById("engines_searchbar").value = category;
+ document.getElementById("engines_searchbar").value = "#" + category;
// collapse category summary
document.getElementById("categories").open = false;
// filter through search engines list