Merge branch 'master' into qr

This commit is contained in:
Nicolas Stepien 2012-01-24 03:51:32 +01:00
commit 2f8052163d
3 changed files with 31 additions and 57 deletions

View File

@ -936,13 +936,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();
@ -1145,10 +1147,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) {
@ -1167,37 +1177,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);
}
};

View File

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

View File

@ -687,11 +687,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
@ -819,10 +821,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: []
@ -838,13 +846,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
@ -854,22 +855,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
qr =