fix: load search script on hover

This commit is contained in:
PCloud 2025-04-05 18:35:02 +01:00
parent 58a8421254
commit 99a827d4de
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View File

@ -233,10 +233,9 @@ function initSearch() {
} else {
window._searchDesktopOnce = true;
// Turn on the mask when clicking on the search button
searchToggle.addEventListener("click", () => {
function loadSearchScript() {
loadScript("autocomplete-script", autocompleteJs, () => {
initAutosearch();
searchInput.focus();
});
if (window.config?.search?.type === "algolia") {
loadScript("algolia-script", algoliaJs, null);
@ -245,6 +244,9 @@ function initSearch() {
} else {
loadPagefind();
}
}
searchToggle.addEventListener("mouseover", loadSearchScript);
searchToggle.addEventListener("click", () => {
document.body.classList.add("blur");
header.classList.add("open");
searchInput.focus();

6
flake.lock generated
View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1742707865,
"narHash": "sha256-RVQQZy38O3Zb8yoRJhuFgWo/iDIDj0hEdRTVfhOtzRk=",
"lastModified": 1743689281,
"narHash": "sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ+VoVdg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b",
"rev": "2bfc080955153be0be56724be6fa5477b4eefabb",
"type": "github"
},
"original": {