diff options
author | Alexandre Flament <alex@al-f.net> | 2022-01-02 22:34:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 22:34:15 +0100 |
commit | 458b7fb72d9429af346578ba37625f3d45607f03 (patch) | |
tree | ce7e5e29f73ff96edb600bc7b8b41919efd1e58f /searx/static/themes/simple/src | |
parent | d83aa2b0d233606b0a037af9086ded656521fd2b (diff) | |
parent | f087d01e245239285880b2a15563dcf0f97aaf83 (diff) | |
download | searxng-458b7fb72d9429af346578ba37625f3d45607f03.tar.gz searxng-458b7fb72d9429af346578ba37625f3d45607f03.zip |
Merge pull request #610 from return42/img-load-error
[fix] simple theme: hide the image if img load fails
Diffstat (limited to 'searx/static/themes/simple/src')
-rw-r--r-- | searx/static/themes/simple/src/js/main/results.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/searx/static/themes/simple/src/js/main/results.js b/searx/static/themes/simple/src/js/main/results.js index b6b4d0834..b9bd43394 100644 --- a/searx/static/themes/simple/src/js/main/results.js +++ b/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'); |