diff --git a/4chan_x.user.js b/4chan_x.user.js index 76a9350b3..cf6b7e2e6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -60,7 +60,6 @@ 'Comment Expansion': [true, 'Can expand too long comments.'], 'Thread Expansion': [true, 'Can expand threads to view all replies.'], 'Index Navigation': [false, 'Navigate to previous / next thread.'], - 'Reply Navigation': [false, 'Navigate to top / bottom of thread.'], 'Check for Updates': [true, 'Check for updated versions of 4chan X Alpha.'] }, Filtering: { @@ -2237,6 +2236,9 @@ Nav = { init: function() { var next, prev, span; + if (g.VIEW !== 'index' || !Conf['Index Navigation']) { + return; + } span = $.el('span', { id: 'navlinks' }); @@ -2256,18 +2258,10 @@ }); }, prev: function() { - if (g.VIEW === 'thread') { - return window.scrollTo(0, 0); - } else { - return Nav.scroll(-1); - } + return Nav.scroll(-1); }, next: function() { - if (g.VIEW === 'thread') { - return window.scrollTo(0, d.body.scrollHeight); - } else { - return Nav.scroll(+1); - } + return Nav.scroll(+1); }, getThread: function(full) { var headRect, i, rect, thread, threads, topMargin, _i, _len; @@ -6153,7 +6147,7 @@ initFeature('Thread Stats', ThreadStats); initFeature('Thread Updater', ThreadUpdater); initFeature('Thread Watcher', ThreadWatcher); - initFeature('Index/Reply Navigation', Nav); + initFeature('Index Navigation', Nav); console.timeEnd('All initializations'); $.on(d, '4chanMainInit', Main.initStyle); return $.ready(Main.initReady); diff --git a/src/config.coffee b/src/config.coffee index 4b45be5ae..30c8dcfa1 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -10,7 +10,6 @@ Config = 'Comment Expansion': [true, 'Can expand too long comments.'] 'Thread Expansion': [true, 'Can expand threads to view all replies.'] 'Index Navigation': [false, 'Navigate to previous / next thread.'] - 'Reply Navigation': [false, 'Navigate to top / bottom of thread.'] 'Check for Updates': [true, 'Check for updated versions of <%= meta.name %>.'] Filtering: 'Anonymize': [false, 'Turn everyone Anonymous.'] diff --git a/src/features.coffee b/src/features.coffee index 7bb9dd1ea..b3bcb03ae 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -1027,6 +1027,8 @@ ArchiveLink = Nav = init: -> + return if g.VIEW isnt 'index' or !Conf['Index Navigation'] + span = $.el 'span', id: 'navlinks' prev = $.el 'a', @@ -1043,16 +1045,10 @@ Nav = $.on d, '4chanXInitFinished', -> $.add d.body, span prev: -> - if g.VIEW is 'thread' - window.scrollTo 0, 0 - else - Nav.scroll -1 + Nav.scroll -1 next: -> - if g.VIEW is 'thread' - window.scrollTo 0, d.body.scrollHeight - else - Nav.scroll +1 + Nav.scroll +1 getThread: (full) -> headRect = $.id('header-bar').getBoundingClientRect() diff --git a/src/main.coffee b/src/main.coffee index df40da97b..f55c2dd29 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -344,7 +344,7 @@ Main = initFeature 'Thread Stats', ThreadStats initFeature 'Thread Updater', ThreadUpdater initFeature 'Thread Watcher', ThreadWatcher - initFeature 'Index/Reply Navigation', Nav + initFeature 'Index Navigation', Nav console.timeEnd 'All initializations' $.on d, '4chanMainInit', Main.initStyle