From fc4ec0749bedf9e999241225d8177e46ba22858b Mon Sep 17 00:00:00 2001 From: Basil Baumgartner Date: Tue, 23 Jul 2024 10:41:51 +0200 Subject: [PATCH 1/2] fix: instantSearch js listener now only registered if enabled in settings --- assets/js/app.js | 18 ++++++++++-------- src/Resources/views/_scripts.html.twig | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index ce425388..7846813f 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -64,12 +64,14 @@ global.MonsieurBizInstantSearch = class { } document.addEventListener("DOMContentLoaded", function() { - new MonsieurBizInstantSearch( - monsieurbizSearchPlugin.instantUrl, - monsieurbizSearchPlugin.searchInputSelector, - monsieurbizSearchPlugin.resultClosestSelector, - monsieurbizSearchPlugin.resultFindSelector, - monsieurbizSearchPlugin.keyUpTimeOut, - monsieurbizSearchPlugin.minQueryLength - ); + if (monsieurbizSearchPlugin.instantEnabled) { + new MonsieurBizInstantSearch( + monsieurbizSearchPlugin.instantUrl, + monsieurbizSearchPlugin.searchInputSelector, + monsieurbizSearchPlugin.resultClosestSelector, + monsieurbizSearchPlugin.resultFindSelector, + monsieurbizSearchPlugin.keyUpTimeOut, + monsieurbizSearchPlugin.minQueryLength + ); + } }); diff --git a/src/Resources/views/_scripts.html.twig b/src/Resources/views/_scripts.html.twig index b112dee9..f8742538 100644 --- a/src/Resources/views/_scripts.html.twig +++ b/src/Resources/views/_scripts.html.twig @@ -1,6 +1,6 @@