reply keybinds

This commit is contained in:
James Campos 2010-11-17 08:41:41 -08:00
parent c4b80e8113
commit 176e05bd07
2 changed files with 114 additions and 96 deletions

View File

@ -387,11 +387,18 @@ keypress = (e) ->
location.pathname = "/#{g.BOARD}/#{temp}#1"
else
if e.shiftKey
location.hash = 10
window.scrollTo 0, 99999
else
window.scrollTo 0, 0
location.hash = ''
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
when "H"
temp = g.PAGENUM - count
@ -434,7 +441,7 @@ keydown = (e) ->
g.keyCode = kc
keyActAdd = ->
if not g.REPLY and getConfig 'Keyboard Actions'
if getConfig 'Keyboard Actions'
d.addEventListener 'keydown', keydown, true
d.addEventListener 'keypress', keypress, true
@ -955,6 +962,14 @@ if getConfig 'Reply Navigation'
addTo span, tn(' '), up, tn(' '), down
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 getConfig('Quick Reply') and getConfig 'Persistent QR'
quickReply()
@ -966,14 +981,6 @@ if g.REPLY
d.title = "/#{g.BOARD}/ - #{text}"
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'
delform = $('form[name=delform]')
#don't confuse other scripts

View File

@ -477,7 +477,7 @@
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1");
} else {
if (e.shiftKey) {
location.hash = 10;
window.scrollTo(0, 99999);
} else {
window.scrollTo(0, 0);
location.hash = '';
@ -485,6 +485,16 @@
}
}
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) {
case "H":
temp = g.PAGENUM - count;
@ -531,6 +541,7 @@
GM_openInTab(href);
break;
}
}
return (g.count = 0);
};
keydown = function(e) {
@ -545,7 +556,7 @@
}
};
keyActAdd = function() {
if (!g.REPLY && getConfig('Keyboard Actions')) {
if (getConfig('Keyboard Actions')) {
d.addEventListener('keydown', keydown, true);
return d.addEventListener('keypress', keypress, true);
}
@ -1233,6 +1244,17 @@
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 (getConfig('Quick Reply') && getConfig('Persistent QR')) {
quickReply();
@ -1247,17 +1269,6 @@
}
}
} 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')) {
delform = $('form[name=delform]');
d.addEventListener('DOMNodeInserted', stopPropagation, true);