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 --- public/js/app.js | 8 ++++++++ resources/js/app.js | 7 +++++++ resources/views/anime.blade.php | 2 +- resources/views/list_anime.blade.php | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 58609e7..99c1139 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -37073,6 +37073,14 @@ module.exports = function(module) { __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); +$(".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 +}); + /***/ }), /***/ "./resources/js/bootstrap.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 +}); diff --git a/resources/views/anime.blade.php b/resources/views/anime.blade.php index 66d9373..0d00cb4 100644 --- a/resources/views/anime.blade.php +++ b/resources/views/anime.blade.php @@ -6,7 +6,7 @@
- +

Synopsis

diff --git a/resources/views/list_anime.blade.php b/resources/views/list_anime.blade.php index a165d96..32ad79b 100644 --- a/resources/views/list_anime.blade.php +++ b/resources/views/list_anime.blade.php @@ -51,7 +51,7 @@

- + {!! replaceSpecialChars(e($anime->synopsis)) !!} -- cgit v1.2.3