From b98fe86c5230c2cf1bae0d8614bdfd47c6129aad Mon Sep 17 00:00:00 2001 From: ozhozh Date: Mon, 14 Sep 2009 19:11:41 +0000 Subject: [PATCH] Fix in Chrome: hide missing images with a js script git-svn-id: http://yourls.googlecode.com/svn/trunk@158 12232710-3e20-11de-b438-597f59cd7555 --- images/blank.gif | Bin 0 -> 42 bytes js/infos.js | 7 +++++++ 2 files changed, 7 insertions(+) create mode 100644 images/blank.gif diff --git a/images/blank.gif b/images/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..f191b280ce91e6cb8c387735c10ef9bc5da6c83b GIT binary patch literal 42 ocmZ?wbhEHbWMp7uXkY+=|Ns9h{$ybUF?B!$NQQxl(S^Yp0J!f4_W%F@ literal 0 HcmV?d00001 diff --git a/js/infos.js b/js/infos.js index a2b40ea..99e449c 100644 --- a/js/infos.js +++ b/js/infos.js @@ -26,5 +26,12 @@ $(document).ready(function(){ $('#'+target).toggle(); return false; }); + + // If an image src is erroneous (404 or anything) replace it with a transparent gif + $('.fix_images').each(function(i,img) { + $(img).error(function(){ + $(img).attr('src', 'images/blank.gif'); + }); + }); }); -- 2.45.0