mirror of
https://github.com/searxng/searxng.git
synced 2026-07-18 14:01:24 +00:00
[mod] show img_load_error.svg if thumbnail fails to load (#6368)
* [mod] show img_load_error.svg if thumbnail fails to load (#6368) Brave and a few other engines occasionally provide dead URLs for the thumbnails, which looks pretty ugly in the UI. As already with the image search, in case of an error img_load_error.svg should be displayed here. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> * [build] /static (#6368) --------- Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
@@ -35,8 +35,9 @@ const imageLoader = (resultElement: HTMLElement): void => {
|
||||
}, 1000) as unknown as number;
|
||||
};
|
||||
|
||||
const imageThumbnails: NodeListOf<HTMLImageElement> =
|
||||
document.querySelectorAll<HTMLImageElement>("#urls img.image_thumbnail");
|
||||
const imageThumbnails: NodeListOf<HTMLImageElement> = document.querySelectorAll<HTMLImageElement>(
|
||||
"#urls img.image_thumbnail, img.thumbnail"
|
||||
);
|
||||
for (const thumbnail of imageThumbnails) {
|
||||
if (thumbnail.complete && thumbnail.naturalWidth === 0) {
|
||||
thumbnail.src = `${settings.theme_static_path}/img/img_load_error.svg`;
|
||||
|
||||
Reference in New Issue
Block a user