diff --git a/4chan_x.user.js b/4chan_x.user.js index 248bb7121..78b34b6d3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -170,6 +170,7 @@ checkbox: { 'Beep': [false, 'Beep on new post to completely read thread.'], 'Auto Scroll': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'], + 'Bottom scroll': [false, 'Always scroll to the bottom, not the first new post. Useful for event threads.'], 'Scroll BG': [false, 'Auto-scroll background tabs.'], 'Auto Update': [true, 'Automatically fetch new posts.'] }, @@ -5224,7 +5225,11 @@ scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25; $.add(ThreadUpdater.root, nodes); if (scroll) { - nodes[0].scrollIntoView(); + if (Conf['Bottom scroll']) { + d.body.scrollTop = d.body.clientHeight; + } else { + nodes[0].scrollIntoView(); + } } $.queueTask(function() { var length, threadID; diff --git a/changelog b/changelog index 18eee8e6a..ceaaf8abe 100644 --- a/changelog +++ b/changelog @@ -17,6 +17,7 @@ alpha There is now a setting to allow expanding spoilers. Added touch and multi-touch support for dragging windows. The Thread Updater will pause when offline, and resume when online. + Added an option to always auto-scroll to the bottom. Thread Stats post and file count will adjust with deleted posts. Added Thread & Post Hiding in the Menu, with individual settings. Thread & Post Hiding Buttons can now be disabled in the settings. diff --git a/src/config.coffee b/src/config.coffee index 548fcf4ec..eb5d9eadb 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -161,8 +161,9 @@ Config = 'Hide': ['x', 'Hide thread.'] updater: checkbox: - 'Beep': [false, 'Beep on new post to completely read thread.'] - 'Auto Scroll': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'] - 'Scroll BG': [false, 'Auto-scroll background tabs.'] - 'Auto Update': [true, 'Automatically fetch new posts.'] + 'Beep': [false, 'Beep on new post to completely read thread.'] + 'Auto Scroll': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'] + 'Bottom scroll': [false, 'Always scroll to the bottom, not the first new post. Useful for event threads.'] + 'Scroll BG': [false, 'Auto-scroll background tabs.'] + 'Auto Update': [true, 'Automatically fetch new posts.'] 'Interval': 30 diff --git a/src/features.coffee b/src/features.coffee index 79eb1d363..515225da8 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -3531,7 +3531,10 @@ ThreadUpdater = ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25 $.add ThreadUpdater.root, nodes if scroll - nodes[0].scrollIntoView() + if Conf['Bottom scroll'] + d.body.scrollTop = d.body.clientHeight + else + nodes[0].scrollIntoView() $.queueTask -> # Enable 4chan features.