From 903449e0b57c50a0f0ec02e4e2a6c8cb9e923dac Mon Sep 17 00:00:00 2001 From: Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:25:30 +0000 Subject: [PATCH] [fix] Images cannot be clicked anymore #3006 URL in sidedbar only exists in HTTP POST requests. On HTTP GET requests the selector ``#search_url button#copy_url`` results in a ``null`` type and a ``.style.display`` raises:: Uncaught TypeError: d.querySelector(...) is null As a result, the initialization of the event handler is no longer carried out. Closes: https://github.com/searxng/searxng/issues/3003 Suggested-by: Markus Heiser --- searx/static/themes/simple/src/js/main/results.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/searx/static/themes/simple/src/js/main/results.js b/searx/static/themes/simple/src/js/main/results.js index 2309297df..0b0aebe12 100644 --- a/searx/static/themes/simple/src/js/main/results.js +++ b/searx/static/themes/simple/src/js/main/results.js @@ -16,7 +16,9 @@ } )); - d.querySelector('#search_url button#copy_url').style.display = "block"; + if (d.querySelector('#search_url button#copy_url')) { + d.querySelector('#search_url button#copy_url').style.display = "block"; + } searxng.on('.btn-collapse', 'click', function () { var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');