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

[fix] simple theme: hide the image if img load fails
This commit is contained in:
Alexandre Flament 2022-01-02 22:34:15 +01:00 committed by GitHub
commit 458b7fb72d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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 = new searxng.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 14, 6, 200);
searxng.image_thumbnail_layout.watch(); 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 () { searxng.on('.btn-collapse', 'click', function () {
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed'); var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed'); var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');