reply keybinds
This commit is contained in:
parent
c4b80e8113
commit
176e05bd07
@ -387,11 +387,18 @@ keypress = (e) ->
|
|||||||
location.pathname = "/#{g.BOARD}/#{temp}#1"
|
location.pathname = "/#{g.BOARD}/#{temp}#1"
|
||||||
else
|
else
|
||||||
if e.shiftKey
|
if e.shiftKey
|
||||||
location.hash = 10
|
window.scrollTo 0, 99999
|
||||||
else
|
else
|
||||||
window.scrollTo 0, 0
|
window.scrollTo 0, 0
|
||||||
location.hash = ''
|
location.hash = ''
|
||||||
count or= 1
|
count or= 1
|
||||||
|
if g.REPLY
|
||||||
|
switch char
|
||||||
|
when "J"
|
||||||
|
window.scrollBy 0, 20 * count
|
||||||
|
when "K"
|
||||||
|
window.scrollBy 0, -20 * count
|
||||||
|
else
|
||||||
switch char
|
switch char
|
||||||
when "H"
|
when "H"
|
||||||
temp = g.PAGENUM - count
|
temp = g.PAGENUM - count
|
||||||
@ -434,7 +441,7 @@ keydown = (e) ->
|
|||||||
g.keyCode = kc
|
g.keyCode = kc
|
||||||
|
|
||||||
keyActAdd = ->
|
keyActAdd = ->
|
||||||
if not g.REPLY and getConfig 'Keyboard Actions'
|
if getConfig 'Keyboard Actions'
|
||||||
d.addEventListener 'keydown', keydown, true
|
d.addEventListener 'keydown', keydown, true
|
||||||
d.addEventListener 'keypress', keypress, true
|
d.addEventListener 'keypress', keypress, true
|
||||||
|
|
||||||
@ -955,6 +962,14 @@ if getConfig 'Reply Navigation'
|
|||||||
addTo span, tn(' '), up, tn(' '), down
|
addTo span, tn(' '), up, tn(' '), down
|
||||||
inAfter el, span
|
inAfter el, span
|
||||||
|
|
||||||
|
if getConfig 'Keyboard Actions'
|
||||||
|
form = $ 'div.postarea > form'
|
||||||
|
inputs = $$ 'input[type=text], textarea', form
|
||||||
|
for input in inputs
|
||||||
|
input.addEventListener 'focus', keyActRem, true
|
||||||
|
input.addEventListener 'blur', keyActAdd, true
|
||||||
|
keyActAdd()
|
||||||
|
|
||||||
if g.REPLY
|
if g.REPLY
|
||||||
if getConfig('Quick Reply') and getConfig 'Persistent QR'
|
if getConfig('Quick Reply') and getConfig 'Persistent QR'
|
||||||
quickReply()
|
quickReply()
|
||||||
@ -966,14 +981,6 @@ if g.REPLY
|
|||||||
d.title = "/#{g.BOARD}/ - #{text}"
|
d.title = "/#{g.BOARD}/ - #{text}"
|
||||||
|
|
||||||
else #not reply
|
else #not reply
|
||||||
if getConfig 'Keyboard Actions'
|
|
||||||
form = $ 'div.postarea > form'
|
|
||||||
inputs = $$ 'input[type=text], textarea', form
|
|
||||||
for input in inputs
|
|
||||||
input.addEventListener 'focus', keyActRem, true
|
|
||||||
input.addEventListener 'blur', keyActAdd, true
|
|
||||||
keyActAdd()
|
|
||||||
|
|
||||||
if getConfig 'Thread Hiding'
|
if getConfig 'Thread Hiding'
|
||||||
delform = $('form[name=delform]')
|
delform = $('form[name=delform]')
|
||||||
#don't confuse other scripts
|
#don't confuse other scripts
|
||||||
|
|||||||
37
4chan_x.js
37
4chan_x.js
@ -477,7 +477,7 @@
|
|||||||
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1");
|
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1");
|
||||||
} else {
|
} else {
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
location.hash = 10;
|
window.scrollTo(0, 99999);
|
||||||
} else {
|
} else {
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
location.hash = '';
|
location.hash = '';
|
||||||
@ -485,6 +485,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
count || (count = 1);
|
count || (count = 1);
|
||||||
|
if (g.REPLY) {
|
||||||
|
switch (char) {
|
||||||
|
case "J":
|
||||||
|
window.scrollBy(0, 20 * count);
|
||||||
|
break;
|
||||||
|
case "K":
|
||||||
|
window.scrollBy(0, -20 * count);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
switch (char) {
|
switch (char) {
|
||||||
case "H":
|
case "H":
|
||||||
temp = g.PAGENUM - count;
|
temp = g.PAGENUM - count;
|
||||||
@ -531,6 +541,7 @@
|
|||||||
GM_openInTab(href);
|
GM_openInTab(href);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (g.count = 0);
|
return (g.count = 0);
|
||||||
};
|
};
|
||||||
keydown = function(e) {
|
keydown = function(e) {
|
||||||
@ -545,7 +556,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
keyActAdd = function() {
|
keyActAdd = function() {
|
||||||
if (!g.REPLY && getConfig('Keyboard Actions')) {
|
if (getConfig('Keyboard Actions')) {
|
||||||
d.addEventListener('keydown', keydown, true);
|
d.addEventListener('keydown', keydown, true);
|
||||||
return d.addEventListener('keypress', keypress, true);
|
return d.addEventListener('keypress', keypress, true);
|
||||||
}
|
}
|
||||||
@ -1233,6 +1244,17 @@
|
|||||||
return _result;
|
return _result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (getConfig('Keyboard Actions')) {
|
||||||
|
form = $('div.postarea > form');
|
||||||
|
inputs = $$('input[type=text], textarea', form);
|
||||||
|
_ref = inputs;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
input = _ref[_i];
|
||||||
|
input.addEventListener('focus', keyActRem, true);
|
||||||
|
input.addEventListener('blur', keyActAdd, true);
|
||||||
|
}
|
||||||
|
keyActAdd();
|
||||||
|
}
|
||||||
if (g.REPLY) {
|
if (g.REPLY) {
|
||||||
if (getConfig('Quick Reply') && getConfig('Persistent QR')) {
|
if (getConfig('Quick Reply') && getConfig('Persistent QR')) {
|
||||||
quickReply();
|
quickReply();
|
||||||
@ -1247,17 +1269,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getConfig('Keyboard Actions')) {
|
|
||||||
form = $('div.postarea > form');
|
|
||||||
inputs = $$('input[type=text], textarea', form);
|
|
||||||
_ref = inputs;
|
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
input = _ref[_i];
|
|
||||||
input.addEventListener('focus', keyActRem, true);
|
|
||||||
input.addEventListener('blur', keyActAdd, true);
|
|
||||||
}
|
|
||||||
keyActAdd();
|
|
||||||
}
|
|
||||||
if (getConfig('Thread Hiding')) {
|
if (getConfig('Thread Hiding')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
d.addEventListener('DOMNodeInserted', stopPropagation, true);
|
d.addEventListener('DOMNodeInserted', stopPropagation, true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user