Browse Source

Merge pull request #610 from return42/img-load-error

[fix] simple theme: hide the image if img load fails
Alexandre Flament 3 years ago
parent
commit
458b7fb72d

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/js/searxng.min.js


File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/js/searxng.min.js.map


+ 9 - 0
searx/static/themes/simple/src/js/main/results.js

@@ -6,6 +6,15 @@
     searxng.image_thumbnail_layout = new searxng.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 14, 6, 200);
     searxng.image_thumbnail_layout.watch();
 
+    d.querySelectorAll('#urls img.image').forEach(
+      img =>
+        img.addEventListener(
+          'error', () => {
+            img.style.display = 'none';
+            img.error = null;
+          }
+        ));
+
     searxng.on('.btn-collapse', 'click', function () {
       var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
       var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');

Some files were not shown because too many files changed in this diff