diff --git a/4chan_x.user.js b/4chan_x.user.js index fa37d7b68..cf7704076 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2995,12 +2995,8 @@ thumb = a.firstChild; if (thumb.hidden) { rect = a.getBoundingClientRect(); - if (rect.top < 0) { - d.body.scrollTop += rect.top + thumb.height / (rect.height / rect.top * -1); - } - if (rect.left < 0) { - d.body.scrollLeft += rect.left + thumb.width / (rect.width / rect.left * -1); - } + if (rect.top < 0) d.body.scrollTop += rect.top; + if (rect.left < 0) d.body.scrollLeft += rect.left; return imgExpand.contract(thumb); } else { return imgExpand.expand(thumb); diff --git a/script.coffee b/script.coffee index 25be94ca4..c5e22e0bf 100644 --- a/script.coffee +++ b/script.coffee @@ -2317,8 +2317,8 @@ imgExpand = thumb = a.firstChild if thumb.hidden rect = a.getBoundingClientRect() - d.body.scrollTop += rect.top + thumb.height / (rect.height / rect.top * -1) if rect.top < 0 - d.body.scrollLeft += rect.left + thumb.width / (rect.width / rect.left * -1) if rect.left < 0 + d.body.scrollTop += rect.top if rect.top < 0 + d.body.scrollLeft += rect.left if rect.left < 0 imgExpand.contract thumb else imgExpand.expand thumb