[mod] simple: apply nojs via stylesheet

This commit is contained in:
vojkovic
2026-09-14 13:38:45 +00:00
committed by Brock Vojkovic
parent 604ee1698c
commit beb324c0f5
8 changed files with 23 additions and 29 deletions

View File

@@ -14,10 +14,6 @@ const categoryButtons: HTMLButtonElement[] = Array.from(
document.querySelectorAll<HTMLButtonElement>("#categories_container button.category")
);
if (searchInput.value.length === 0) {
searchReset.classList.add("empty");
}
// focus search input on large screens
if (!(isMobile || isResultsPage)) {
searchInput.focus();
@@ -35,15 +31,10 @@ if (isMobile) {
});
}
listen("input", searchInput, () => {
searchReset.classList.toggle("empty", searchInput.value.length === 0);
});
listen("click", searchReset, (event: MouseEvent) => {
event.preventDefault();
searchInput.value = "";
searchInput.focus();
searchReset.classList.add("empty");
});
for (const button of categoryButtons) {

View File

@@ -0,0 +1,9 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
.hide_if_nojs {
display: none !important;
}
.show_if_nojs {
display: inline !important;
}

View File

@@ -164,14 +164,14 @@ button.category_button {
&:hover {
color: var(--color-search-background-hover);
}
&.empty * {
display: none;
}
}
html.no-js #clear_search.hide_if_nojs {
display: none;
#q:placeholder-shown ~ #clear_search {
pointer-events: none;
* {
display: none;
}
}
#q,
@@ -204,12 +204,6 @@ html.no-js #clear_search.hide_if_nojs {
}
}
.no-js #clear_search,
.no-js #send_search {
width: auto !important;
.ltr-border-left(1px solid var(--color-search-border));
}
.search_filters {
margin-top: 0.6rem;
.ltr-margin-right(0);

View File

@@ -4,11 +4,7 @@
// stylelint-disable no-descending-specificity
html.no-js .hide_if_nojs {
display: none;
}
html.js .show_if_nojs {
.show_if_nojs {
display: none;
}

View File

@@ -52,7 +52,8 @@ export default {
// stylesheets
ltr: `${PATH.src}/less/style-ltr.less`,
rtl: `${PATH.src}/less/style-rtl.less`,
rss: `${PATH.src}/less/rss.less`
rss: `${PATH.src}/less/rss.less`,
noscript: `${PATH.src}/less/noscript.less`
},
// file naming conventions / pathnames are relative to outDir (PATH.dist)