From dfed85d6d1b3f9e244f5e8185677668bce696d11 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 25 Apr 2011 19:06:52 -0700 Subject: [PATCH] @page bottom, next thread -> next page --- 4chan_x.js | 8 +++++--- script.coffee | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index a0994e083..e1a77c0db 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -827,9 +827,11 @@ window.scrollTo(0, 0); return; } - if (i === nav.threads.length) { - window.location = "" + (g.PAGENUM + 1) + "#p0"; - return; + if (delta === +1) { + if (i === nav.threads.length || (innerHeight + pageYOffset === d.body.scrollHeight)) { + window.location = "" + (g.PAGENUM + 1) + "#p0"; + return; + } } top = nav.threads[i].getBoundingClientRect().top; return window.scrollBy(0, top); diff --git a/script.coffee b/script.coffee index b64928cbc..e6c499f4c 100644 --- a/script.coffee +++ b/script.coffee @@ -615,9 +615,12 @@ nav = if i is -1 window.scrollTo 0, 0 return - if i is nav.threads.length - window.location = "#{g.PAGENUM + 1}#p0" - return + if delta is +1 + # if we're at the last thread, or we're at the bottom of the page. + # kind of hackish, what we really need to do is make nav.getThread smarter. + if i is nav.threads.length or (innerHeight + pageYOffset == d.body.scrollHeight) + window.location = "#{g.PAGENUM + 1}#p0" + return {top} = nav.threads[i].getBoundingClientRect() window.scrollBy 0, top