Add option to auto-scroll to the bottom.

This commit is contained in:
Nicolas Stepien 2013-02-21 00:51:25 +01:00
parent 242208760f
commit d9e3e7d55c
4 changed files with 16 additions and 6 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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.