use getThread in scroll
This commit is contained in:
parent
d149f2c89f
commit
69f1cc43d5
@ -278,7 +278,7 @@ getThread = ->
|
||||
for thread in threads
|
||||
bottom = thread.getBoundingClientRect().bottom
|
||||
if bottom > 0 #we have not scrolled past
|
||||
return thread
|
||||
return [thread, _i]
|
||||
|
||||
formSubmit = (e) ->
|
||||
if span = @nextSibling
|
||||
@ -420,7 +420,7 @@ keypress = (e) ->
|
||||
quickReply.call qrLink
|
||||
when "J"
|
||||
if e.shiftKey
|
||||
thread = getThread()
|
||||
[thread] = getThread()
|
||||
replies = $$ 'td[id]', thread
|
||||
for reply in replies
|
||||
if reply.className is 'replyhl'
|
||||
@ -432,7 +432,7 @@ keypress = (e) ->
|
||||
scroll count
|
||||
when "K"
|
||||
if e.shiftKey
|
||||
thread = getThread()
|
||||
[thread] = getThread()
|
||||
replies = $$ 'td[id]', thread
|
||||
for reply in replies
|
||||
if reply.className is 'replyhl'
|
||||
@ -637,13 +637,8 @@ report = ->
|
||||
input.click()
|
||||
|
||||
scroll = (count) ->
|
||||
threads = $$ 'div.thread'
|
||||
for thread in threads
|
||||
bottom = thread.getBoundingClientRect().bottom
|
||||
if bottom > 0 #we have not scrolled past
|
||||
top = thread.getBoundingClientRect().top
|
||||
idx = _i
|
||||
break
|
||||
[thread, idx] = getThread()
|
||||
top = thread.getBoundingClientRect().top
|
||||
if idx is 0 and top > 1
|
||||
#we haven't scrolled to the first thread
|
||||
idx = -1
|
||||
|
||||
25
4chan_x.js
25
4chan_x.js
@ -349,7 +349,7 @@
|
||||
thread = _ref[_i];
|
||||
bottom = thread.getBoundingClientRect().bottom;
|
||||
if (bottom > 0) {
|
||||
return thread;
|
||||
return [thread, _i];
|
||||
}
|
||||
}
|
||||
return _result;
|
||||
@ -523,7 +523,8 @@
|
||||
return quickReply.call(qrLink);
|
||||
case "J":
|
||||
if (e.shiftKey) {
|
||||
thread = getThread();
|
||||
_ref = getThread();
|
||||
thread = _ref[0];
|
||||
replies = $$('td[id]', thread);
|
||||
_ref = replies;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
@ -541,7 +542,8 @@
|
||||
break;
|
||||
case "K":
|
||||
if (e.shiftKey) {
|
||||
thread = getThread();
|
||||
_ref = getThread();
|
||||
thread = _ref[0];
|
||||
replies = $$('td[id]', thread);
|
||||
_ref = replies;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
@ -822,18 +824,11 @@
|
||||
return input.click();
|
||||
};
|
||||
scroll = function(count) {
|
||||
var _i, _len, _ref, bottom, hash, idx, temp, thread, threads, top;
|
||||
threads = $$('div.thread');
|
||||
_ref = threads;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
thread = _ref[_i];
|
||||
bottom = thread.getBoundingClientRect().bottom;
|
||||
if (bottom > 0) {
|
||||
top = thread.getBoundingClientRect().top;
|
||||
idx = _i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var _ref, hash, idx, temp, thread, top;
|
||||
_ref = getThread();
|
||||
thread = _ref[0];
|
||||
idx = _ref[1];
|
||||
top = thread.getBoundingClientRect().top;
|
||||
if (idx === 0 && top > 1) {
|
||||
idx = -1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user