From b57bab1cf2e3e7d9b965bade697f209d8957080a Mon Sep 17 00:00:00 2001 From: horus Date: Sat, 19 Sep 2020 02:13:24 +0200 Subject: dynamically update img src when camo proxy fails --- resources/js/app.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'resources/js') diff --git a/resources/js/app.js b/resources/js/app.js index 40c55f6..37e0fdb 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1 +1,8 @@ require('./bootstrap'); + +$(".mal-img").not(".mal-img-error").on("error", function() { + if ( ! $(this).hasClass("mal-img-error") ) { + this.src = $(this).data("img-src"); + } + $(this).addClass('mal-img-error'); // prevents loops +}); -- cgit v1.2.3