From 07ecbda653f13e8d7bb0234962c5a6d9388960a0 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 22 Sep 2011 04:39:50 +0200 Subject: [PATCH] automatically reload pictures --- 4chan_x.user.js | 5 +++++ changelog | 1 + script.coffee | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2fa2d09c5..415bf2ac8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2727,6 +2727,11 @@ _ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1]; img.style.maxWidth = "-moz-calc(" + max + "px)"; } + $.bind(img, 'error', function(e) { + thumb = this.previousSibling; + imgExpand.contract(thumb); + return imgExpand.expand(thumb); + }); return $.add(a, img); }, dialog: function() { diff --git a/changelog b/changelog index df4ada742..9ddeeb680 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - mayhem initiate 4chan X earlier + automatically reload expanded pictures on error 2.20.1 - mayhem diff --git a/script.coffee b/script.coffee index b928e5a2e..06f389a51 100644 --- a/script.coffee +++ b/script.coffee @@ -2018,6 +2018,10 @@ imgExpand = filesize = $ 'span.filesize', a.parentNode [_, max] = filesize.textContent.match /(\d+)x/ img.style.maxWidth = "-moz-calc(#{max}px)" + $.bind img, 'error', (e) -> + thumb = @previousSibling + imgExpand.contract thumb + imgExpand.expand thumb $.add a, img dialog: ->