Do not cycle through board pages with Index Navigation or See next/previous thread keybinds.
This commit is contained in:
parent
eee2defe4d
commit
48afb6d880
@ -947,13 +947,15 @@
|
||||
keybinds.img(thread);
|
||||
break;
|
||||
case conf.nextThread:
|
||||
nav.next();
|
||||
if (g.REPLY) return;
|
||||
nav.scroll(+1);
|
||||
break;
|
||||
case conf.openThreadTab:
|
||||
keybinds.open(thread, true);
|
||||
break;
|
||||
case conf.previousThread:
|
||||
nav.prev();
|
||||
if (g.REPLY) return;
|
||||
nav.scroll(-1);
|
||||
break;
|
||||
case conf.update:
|
||||
updater.update();
|
||||
@ -1160,10 +1162,18 @@
|
||||
return $.add(d.body, span);
|
||||
},
|
||||
prev: function() {
|
||||
return nav.scroll(-1);
|
||||
if (g.REPLY) {
|
||||
return window.scrollTo(0, 0);
|
||||
} else {
|
||||
return nav.scroll(-1);
|
||||
}
|
||||
},
|
||||
next: function() {
|
||||
return nav.scroll(+1);
|
||||
if (g.REPLY) {
|
||||
return window.scrollTo(0, d.body.scrollHeight);
|
||||
} else {
|
||||
return nav.scroll(+1);
|
||||
}
|
||||
},
|
||||
threads: [],
|
||||
getThread: function(full) {
|
||||
@ -1182,37 +1192,13 @@
|
||||
return null;
|
||||
},
|
||||
scroll: function(delta) {
|
||||
var i, rect, thread, top, _ref;
|
||||
if (g.REPLY) {
|
||||
if (delta === -1) {
|
||||
window.scrollTo(0, 0);
|
||||
} else {
|
||||
window.scrollTo(0, d.body.scrollHeight);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var i, rect, thread, top, _ref, _ref2;
|
||||
_ref = nav.getThread(true), thread = _ref[0], i = _ref[1], rect = _ref[2];
|
||||
top = rect.top;
|
||||
if (!((delta === -1 && Math.ceil(top) < 0) || (delta === +1 && top > 1))) {
|
||||
i += delta;
|
||||
}
|
||||
if (i === -1) {
|
||||
if (g.PAGENUM === 0) {
|
||||
window.scrollTo(0, 0);
|
||||
} else {
|
||||
window.location = "" + (g.PAGENUM - 1) + "#0";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (delta === +1) {
|
||||
if (i === nav.threads.length || (innerHeight + pageYOffset === d.body.scrollHeight)) {
|
||||
if ($('table.pages input[value="Next"]')) {
|
||||
window.location = "" + (g.PAGENUM + 1) + "#0";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
top = nav.threads[i].getBoundingClientRect().top;
|
||||
top = (_ref2 = nav.threads[i]) != null ? _ref2.getBoundingClientRect().top : void 0;
|
||||
return window.scrollBy(0, top);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
master
|
||||
- Mayhem
|
||||
Index Navigation and the See next/previous thread keybinds will not cycle through board pages anymore.
|
||||
|
||||
2.24.4
|
||||
- ahokadesuka
|
||||
|
||||
@ -692,11 +692,13 @@ keybinds =
|
||||
when conf.expandImages
|
||||
keybinds.img thread
|
||||
when conf.nextThread
|
||||
nav.next()
|
||||
return if g.REPLY
|
||||
nav.scroll +1
|
||||
when conf.openThreadTab
|
||||
keybinds.open thread, true
|
||||
when conf.previousThread
|
||||
nav.prev()
|
||||
return if g.REPLY
|
||||
nav.scroll -1
|
||||
when conf.update
|
||||
updater.update()
|
||||
when conf.watch
|
||||
@ -828,10 +830,16 @@ nav =
|
||||
$.add d.body, span
|
||||
|
||||
prev: ->
|
||||
nav.scroll -1
|
||||
if g.REPLY
|
||||
window.scrollTo 0, 0
|
||||
else
|
||||
nav.scroll -1
|
||||
|
||||
next: ->
|
||||
nav.scroll +1
|
||||
if g.REPLY
|
||||
window.scrollTo 0, d.body.scrollHeight
|
||||
else
|
||||
nav.scroll +1
|
||||
|
||||
threads: []
|
||||
|
||||
@ -847,13 +855,6 @@ nav =
|
||||
return null
|
||||
|
||||
scroll: (delta) ->
|
||||
if g.REPLY
|
||||
if delta is -1
|
||||
window.scrollTo 0,0
|
||||
else
|
||||
window.scrollTo 0, d.body.scrollHeight
|
||||
return
|
||||
|
||||
[thread, i, rect] = nav.getThread true
|
||||
{top} = rect
|
||||
|
||||
@ -863,22 +864,7 @@ nav =
|
||||
unless (delta is -1 and Math.ceil(top) < 0) or (delta is +1 and top > 1)
|
||||
i += delta
|
||||
|
||||
if i is -1
|
||||
if g.PAGENUM is 0
|
||||
window.scrollTo 0, 0
|
||||
else
|
||||
window.location = "#{g.PAGENUM - 1}#0"
|
||||
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)
|
||||
if $ 'table.pages input[value="Next"]'
|
||||
window.location = "#{g.PAGENUM + 1}#0"
|
||||
return
|
||||
#TODO sfx
|
||||
|
||||
{top} = nav.threads[i].getBoundingClientRect()
|
||||
{top} = nav.threads[i]?.getBoundingClientRect()
|
||||
window.scrollBy 0, top
|
||||
|
||||
options =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user