diff --git a/4chan_x.user.js b/4chan_x.user.js index 370e5793e..568af7011 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3485,8 +3485,8 @@ var rect, thumb; thumb = a.firstChild; if (thumb.hidden) { - rect = a.parentNode.getBoundingClientRect(); - if (rect.top < 0) d.body.scrollTop += rect.top; + rect = a.getBoundingClientRect(); + if (rect.top < 0) d.body.scrollTop += rect.top - 42; if (rect.left < 0) d.body.scrollLeft += rect.left; return imgExpand.contract(thumb); } else { diff --git a/changelog b/changelog index 720fb7fe2..3ecc345cc 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - ahodesuka Add Open Reply in New Tab option for replies made from the main board (not dumping). + Scroll back up (top of anchor - 42px) when unexpanding images. - Mayhem The Filter now has per filter settings: - Filter the OP only along its thread, replies only, or both. diff --git a/script.coffee b/script.coffee index 344b03cfb..17b357a0b 100644 --- a/script.coffee +++ b/script.coffee @@ -2804,8 +2804,8 @@ imgExpand = toggle: (a) -> thumb = a.firstChild if thumb.hidden - rect = a.parentNode.getBoundingClientRect() - d.body.scrollTop += rect.top if rect.top < 0 + rect = a.getBoundingClientRect() + d.body.scrollTop += rect.top - 42 if rect.top < 0 d.body.scrollLeft += rect.left if rect.left < 0 imgExpand.contract thumb else