summaryrefslogtreecommitdiff
path: root/resources/js/app.js
diff options
context:
space:
mode:
authorhorus2020-09-19 02:13:24 +0200
committerhorus2020-09-19 02:13:24 +0200
commitb57bab1cf2e3e7d9b965bade697f209d8957080a (patch)
tree58aa6bf9726945617178aaca6fffe929f6ec3704 /resources/js/app.js
parent8e6c5c4b8f59e9874aa99bb5db5de8f521de0ab3 (diff)
downloadsenpai-b57bab1cf2e3e7d9b965bade697f209d8957080a.tar.gz
dynamically update img src when camo proxy fails
Diffstat (limited to 'resources/js/app.js')
-rw-r--r--resources/js/app.js7
1 files changed, 7 insertions, 0 deletions
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
+});