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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB