[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 <markus.heiser@darmarit.de>
This commit is contained in:
Jinyuan Huang 2023-11-14 11:25:30 +00:00 committed by Markus Heiser
parent 76b91a3ef6
commit 903449e0b5
1 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,9 @@
} }
)); ));
if (d.querySelector('#search_url button#copy_url')) {
d.querySelector('#search_url button#copy_url').style.display = "block"; d.querySelector('#search_url button#copy_url').style.display = "block";
}
searxng.on('.btn-collapse', 'click', function () { searxng.on('.btn-collapse', 'click', function () {
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed'); var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');