Browse Source

[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>
Jinyuan Huang 1 year ago
parent
commit
903449e0b5
1 changed files with 3 additions and 1 deletions
  1. 3 1
      searx/static/themes/simple/src/js/main/results.js

+ 3 - 1
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');