<S-J>, <S-K>
This commit is contained in:
parent
a100ba91dd
commit
d149f2c89f
@ -273,6 +273,13 @@ expandThread = ->
|
|||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getThread = ->
|
||||||
|
threads = $$ 'div.thread'
|
||||||
|
for thread in threads
|
||||||
|
bottom = thread.getBoundingClientRect().bottom
|
||||||
|
if bottom > 0 #we have not scrolled past
|
||||||
|
return thread
|
||||||
|
|
||||||
formSubmit = (e) ->
|
formSubmit = (e) ->
|
||||||
if span = @nextSibling
|
if span = @nextSibling
|
||||||
remove span
|
remove span
|
||||||
@ -384,6 +391,7 @@ keypress = (e) ->
|
|||||||
else
|
else
|
||||||
g.count = (count * 10) + temp
|
g.count = (count * 10) + temp
|
||||||
return
|
return
|
||||||
|
g.count = 0
|
||||||
if char is "G"
|
if char is "G"
|
||||||
if count
|
if count
|
||||||
temp = if count > 15 then 15 else count
|
temp = if count > 15 then 15 else count
|
||||||
@ -411,9 +419,29 @@ keypress = (e) ->
|
|||||||
qrLink = $ "#{hash} ~ span[id] a:not(:first-child)"
|
qrLink = $ "#{hash} ~ span[id] a:not(:first-child)"
|
||||||
quickReply.call qrLink
|
quickReply.call qrLink
|
||||||
when "J"
|
when "J"
|
||||||
scroll count
|
if e.shiftKey
|
||||||
|
thread = getThread()
|
||||||
|
replies = $$ 'td[id]', thread
|
||||||
|
for reply in replies
|
||||||
|
if reply.className is 'replyhl'
|
||||||
|
reply.className = 'reply'
|
||||||
|
replies[_i+1]?.className = 'replyhl'
|
||||||
|
return
|
||||||
|
replies[0].className = 'replyhl'
|
||||||
|
else
|
||||||
|
scroll count
|
||||||
when "K"
|
when "K"
|
||||||
scroll count * -1
|
if e.shiftKey
|
||||||
|
thread = getThread()
|
||||||
|
replies = $$ 'td[id]', thread
|
||||||
|
for reply in replies
|
||||||
|
if reply.className is 'replyhl'
|
||||||
|
reply.className = 'reply'
|
||||||
|
replies[_i-1]?.className = 'replyhl'
|
||||||
|
return
|
||||||
|
replies[_len-1].className = 'replyhl'
|
||||||
|
else
|
||||||
|
scroll count * -1
|
||||||
when "L"
|
when "L"
|
||||||
temp = g.PAGENUM + count
|
temp = g.PAGENUM + count
|
||||||
if temp > 15 then temp = 15
|
if temp > 15 then temp = 15
|
||||||
@ -424,7 +452,6 @@ keypress = (e) ->
|
|||||||
when "O"
|
when "O"
|
||||||
href = $("#{hash} ~ span[id] a:last-of-type").href
|
href = $("#{hash} ~ span[id] a:last-of-type").href
|
||||||
GM_openInTab href
|
GM_openInTab href
|
||||||
g.count = 0
|
|
||||||
|
|
||||||
keydown = (e) ->
|
keydown = (e) ->
|
||||||
kc = e.keyCode
|
kc = e.keyCode
|
||||||
|
|||||||
74
4chan_x.js
74
4chan_x.js
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, AEOS, DAY, _, _i, _len, _ref, _ref2, a, addTo, arr, as, autoWatch, autohide, b, board, callback, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expandComment, expandThread, form, formSubmit, g, getConfig, getTime, hide, hideReply, hideThread, href, html, id, iframe, iframeLoad, inAfter, inBefore, input, inputs, keybindAdd, keybindRem, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, scroll, show, showReply, showThread, slice, span, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watcher, watcherUpdate, x;
|
var $, $$, AEOS, DAY, _, _i, _len, _ref, _ref2, a, addTo, arr, as, autoWatch, autohide, b, board, callback, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expandComment, expandThread, form, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, id, iframe, iframeLoad, inAfter, inBefore, input, inputs, keybindAdd, keybindRem, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, scroll, show, showReply, showThread, slice, span, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watcher, watcherUpdate, x;
|
||||||
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
||||||
config = {
|
config = {
|
||||||
'Thread Hiding': [true, 'Hide entire threads'],
|
'Thread Hiding': [true, 'Hide entire threads'],
|
||||||
@ -341,6 +341,19 @@
|
|||||||
id: id
|
id: id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
getThread = function() {
|
||||||
|
var _i, _len, _ref, _result, bottom, thread, threads;
|
||||||
|
threads = $$('div.thread');
|
||||||
|
_result = []; _ref = threads;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
thread = _ref[_i];
|
||||||
|
bottom = thread.getBoundingClientRect().bottom;
|
||||||
|
if (bottom > 0) {
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _result;
|
||||||
|
};
|
||||||
formSubmit = function(e) {
|
formSubmit = function(e) {
|
||||||
var _ref, _ref2, recaptcha, span;
|
var _ref, _ref2, recaptcha, span;
|
||||||
if (span = this.nextSibling) {
|
if (span = this.nextSibling) {
|
||||||
@ -457,7 +470,7 @@
|
|||||||
return d.removeEventListener('keypress', keypress, true);
|
return d.removeEventListener('keypress', keypress, true);
|
||||||
};
|
};
|
||||||
keypress = function(e) {
|
keypress = function(e) {
|
||||||
var _i, _len, char, count, hash, href, img, kc, qrLink, temp;
|
var _i, _len, _ref, char, count, hash, href, img, kc, qrLink, replies, reply, temp, thread;
|
||||||
kc = g.keyCode;
|
kc = g.keyCode;
|
||||||
if (kc === -1) {
|
if (kc === -1) {
|
||||||
return null;
|
return null;
|
||||||
@ -475,6 +488,7 @@
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
g.count = 0;
|
||||||
if (char === "G") {
|
if (char === "G") {
|
||||||
if (count) {
|
if (count) {
|
||||||
temp = count > 15 ? 15 : count;
|
temp = count > 15 ? 15 : count;
|
||||||
@ -492,11 +506,9 @@
|
|||||||
if (g.REPLY) {
|
if (g.REPLY) {
|
||||||
switch (char) {
|
switch (char) {
|
||||||
case "J":
|
case "J":
|
||||||
window.scrollBy(0, 20 * count);
|
return window.scrollBy(0, 20 * count);
|
||||||
break;
|
|
||||||
case "K":
|
case "K":
|
||||||
window.scrollBy(0, -20 * count);
|
return window.scrollBy(0, -20 * count);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (char) {
|
switch (char) {
|
||||||
@ -505,36 +517,60 @@
|
|||||||
if (temp < 0) {
|
if (temp < 0) {
|
||||||
temp = 0;
|
temp = 0;
|
||||||
}
|
}
|
||||||
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1");
|
return (location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1"));
|
||||||
break;
|
|
||||||
case "I":
|
case "I":
|
||||||
qrLink = $("" + (hash) + " ~ span[id] a:not(:first-child)");
|
qrLink = $("" + (hash) + " ~ span[id] a:not(:first-child)");
|
||||||
quickReply.call(qrLink);
|
return quickReply.call(qrLink);
|
||||||
break;
|
|
||||||
case "J":
|
case "J":
|
||||||
scroll(count);
|
if (e.shiftKey) {
|
||||||
|
thread = getThread();
|
||||||
|
replies = $$('td[id]', thread);
|
||||||
|
_ref = replies;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
reply = _ref[_i];
|
||||||
|
if (reply.className === 'replyhl') {
|
||||||
|
reply.className = 'reply';
|
||||||
|
replies[_i + 1] == null ? undefined : replies[_i + 1].className = 'replyhl';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (replies[0].className = 'replyhl');
|
||||||
|
} else {
|
||||||
|
return scroll(count);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "K":
|
case "K":
|
||||||
scroll(count * -1);
|
if (e.shiftKey) {
|
||||||
|
thread = getThread();
|
||||||
|
replies = $$('td[id]', thread);
|
||||||
|
_ref = replies;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
reply = _ref[_i];
|
||||||
|
if (reply.className === 'replyhl') {
|
||||||
|
reply.className = 'reply';
|
||||||
|
replies[_i - 1] == null ? undefined : replies[_i - 1].className = 'replyhl';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (replies[_len - 1].className = 'replyhl');
|
||||||
|
} else {
|
||||||
|
return scroll(count * -1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "L":
|
case "L":
|
||||||
temp = g.PAGENUM + count;
|
temp = g.PAGENUM + count;
|
||||||
if (temp > 15) {
|
if (temp > 15) {
|
||||||
temp = 15;
|
temp = 15;
|
||||||
}
|
}
|
||||||
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#0");
|
return (location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#0"));
|
||||||
break;
|
|
||||||
case "M":
|
case "M":
|
||||||
img = $("" + (hash) + " ~ img");
|
img = $("" + (hash) + " ~ img");
|
||||||
watch.call(img);
|
return watch.call(img);
|
||||||
break;
|
|
||||||
case "O":
|
case "O":
|
||||||
href = $("" + (hash) + " ~ span[id] a:last-of-type").href;
|
href = $("" + (hash) + " ~ span[id] a:last-of-type").href;
|
||||||
GM_openInTab(href);
|
return GM_openInTab(href);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (g.count = 0);
|
|
||||||
};
|
};
|
||||||
keydown = function(e) {
|
keydown = function(e) {
|
||||||
var kc;
|
var kc;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user