From bba5343206ca3f33c27b46041cbeed2acab143f8 Mon Sep 17 00:00:00 2001 From: Damillora Date: Sat, 8 May 2021 12:43:27 +0700 Subject: [PATCH] fix: remove search delay --- assets/js/lib/search.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/js/lib/search.js b/assets/js/lib/search.js index c879b28..7da5901 100644 --- a/assets/js/lib/search.js +++ b/assets/js/lib/search.js @@ -18,20 +18,18 @@ async function searchPosts(query) { document.getElementById("search-results").innerHTML = result; } -let searchTimeout; if (window.yurikoSearchEndpoint != undefined) { var el = document.getElementById("search-query"); el.addEventListener("input", function (e) { - if (searchTimeout) window.clearTimeout(searchTimeout); var val = el.value; if (val !== "") { document.getElementById("nav-menu").classList.add("menu__item--hidden") - searchTimeout = window.setTimeout(() => searchPosts(val), 2000); + searchPosts(val); } else { document.getElementById("nav-menu").classList.remove("menu__item--hidden") document.getElementById("search-results").innerHTML = ``; } }); -} \ No newline at end of file +}