[fix] if image load fails on client side, show default image

BTW: change icon color from red to gray

Closes:

- https://github.com/searxng/searxng/issues/4066

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2024-11-29 16:57:28 +01:00 committed by Markus Heiser
parent 4a8d333d5b
commit 8c3f0c3d52
3 changed files with 5 additions and 5 deletions

View File

@ -7,13 +7,14 @@
}
searxng.ready(function () {
d.querySelectorAll('#urls img.image').forEach(
d.querySelectorAll('#urls img').forEach(
img =>
img.addEventListener(
'error', () => {
img.style.display = 'none';
img.error = null;
}
// console.log("ERROR can't load: " + img.src);
img.src = window.searxng.settings.theme_static_path + "/img/img_load_error.svg";
},
{once: true}
));
if (d.querySelector('#search_url button#copy_url')) {

View File

@ -14,6 +14,5 @@ module.exports = {
'sortAttrs',
// Optimize SVG for WEB usage
'convertStyleToAttrs',
'removeXMLNS'
],
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB