fixed bugs:
- suppressed display of search results if nothing was found but there were previous searches - improved display timing of search results/initial pages, which led to false displays
This commit is contained in:
parent
49eda4ce0a
commit
15f743d8ab
@ -17,8 +17,10 @@ export function fetchQuery(fetchString, clearResults) {
|
|||||||
function parseContent(content, clearResults) {
|
function parseContent(content, clearResults) {
|
||||||
if (content.length === 0) {
|
if (content.length === 0) {
|
||||||
searchSection.querySelector("#nothing-found ").classList.remove("hidden");
|
searchSection.querySelector("#nothing-found ").classList.remove("hidden");
|
||||||
|
searchSection.querySelector(".datasets").classList.add("hidden");
|
||||||
} else {
|
} else {
|
||||||
searchSection.querySelector("#nothing-found").classList.add("hidden");
|
searchSection.querySelector("#nothing-found").classList.add("hidden");
|
||||||
|
searchSection.querySelector(".datasets").classList.remove("hidden");
|
||||||
const datasets = content.map(dataset => new Dataset(dataset));
|
const datasets = content.map(dataset => new Dataset(dataset));
|
||||||
if (clearResults) {
|
if (clearResults) {
|
||||||
Array.from(searchSection.querySelectorAll(".datasets .dataset")).forEach(e => e.remove());
|
Array.from(searchSection.querySelectorAll(".datasets .dataset")).forEach(e => e.remove());
|
||||||
|
@ -78,10 +78,6 @@ header {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#search-entry:focus-visible {
|
#search-entry:focus-visible {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
@ -93,6 +89,11 @@ header {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@container (width < 60ch) {
|
@container (width < 60ch) {
|
||||||
.datasets {
|
.datasets {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
@ -47,10 +47,10 @@ searchButton.addEventListener("click", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
searchBar.addEventListener("input", () => {
|
searchBar.addEventListener("input", () => {
|
||||||
updateSections();
|
|
||||||
clearTimeout(searchBarTimeout);
|
clearTimeout(searchBarTimeout);
|
||||||
searchBarTimeout = setTimeout(() => {
|
searchBarTimeout = setTimeout(() => {
|
||||||
fetchQuery(createQuery(), true);
|
fetchQuery(createQuery(), true);
|
||||||
|
updateSections();
|
||||||
}, searchDelay);
|
}, searchDelay);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user