From 659e82b4528507ff65ae39b10f8fd4b49589cdec Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Tue, 7 May 2024 16:43:50 +0800 Subject: [PATCH] Remove local_search.trigger option --- _config.yml | 3 --- source/js/third-party/search/local-search.js | 11 +---------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/_config.yml b/_config.yml index a4f27bf6f..34809c6d7 100644 --- a/_config.yml +++ b/_config.yml @@ -863,9 +863,6 @@ algolia_search: # Dependencies: https://github.com/next-theme/hexo-generator-searchdb local_search: enable: false - # If auto, trigger search by changing input. - # If manual, trigger search by pressing enter key or search button. - trigger: auto # Show top n results per article, show all results by setting to -1 top_n_per_article: 1 # Unescape html strings to the readable one. diff --git a/source/js/third-party/search/local-search.js b/source/js/third-party/search/local-search.js index a44ef753d..0bcdeac4d 100644 --- a/source/js/third-party/search/local-search.js +++ b/source/js/third-party/search/local-search.js @@ -51,16 +51,7 @@ document.addEventListener('DOMContentLoaded', () => { localSearch.fetchData(); } - if (CONFIG.localsearch.trigger === 'auto') { - input.addEventListener('input', inputEventFunction); - } else { - document.querySelector('.search-icon').addEventListener('click', inputEventFunction); - input.addEventListener('keypress', event => { - if (event.key === 'Enter') { - inputEventFunction(); - } - }); - } + input.addEventListener('input', inputEventFunction); window.addEventListener('search:loaded', inputEventFunction); // Handle and trigger popup window