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