keyAct -> keybind

This commit is contained in:
James Campos 2010-11-18 21:09:04 -08:00
parent 5ace92792e
commit 6af0eca109
2 changed files with 35 additions and 36 deletions

View File

@ -200,7 +200,7 @@ autoWatch = ->
closeQR = ->
div = this.parentNode.parentNode
remove div
keyActAdd()
keybindAdd()
clearHidden = ->
#'hidden' might be misleading; it's the number of IDs we're *looking* for,
@ -279,7 +279,7 @@ formSubmit = (e) ->
recaptcha = $('input[name=recaptcha_response_field]', this)
if recaptcha.value
$('#qr input[title=autohide]:not(:checked)')?.click()
keyActAdd()
keybindAdd()
else
e.preventDefault()
span = n 'span',
@ -345,7 +345,7 @@ iframeLoad = ->
className: 'error'
addTo qr, span
$('input[title=autohide]:checked', qr)?.click()
keyActRem()
keybindRem()
else if g.REPLY and getConfig 'Persistent QR'
$('textarea', qr).value = ''
$('input[name=recaptcha_response_field]', qr).value = ''
@ -361,6 +361,14 @@ iframeLoad = ->
remove qr
recaptchaReload()
keybindAdd = ->
if getConfig 'Keybinds'
d.addEventListener 'keydown', keydown, true
d.addEventListener 'keypress', keypress, true
keybindRem = ->
d.removeEventListener 'keydown', keydown, true
d.removeEventListener 'keypress', keypress, true
keypress = (e) ->
kc = g.keyCode
@ -438,15 +446,6 @@ keydown = (e) ->
else
g.keyCode = kc
keyActAdd = ->
if getConfig 'Keybinds'
d.addEventListener 'keydown', keydown, true
d.addEventListener 'keypress', keypress, true
keyActRem = ->
d.removeEventListener 'keydown', keydown, true
d.removeEventListener 'keypress', keypress, true
nodeInserted = (e) ->
target = e.target
if target.nodeName is 'TABLE'
@ -555,8 +554,8 @@ quickReply = (e) ->
if getConfig 'Keybinds'
inputs = $$ 'input[type=text], textarea', clone
for input in inputs
input.addEventListener 'focus', keyActRem, true
input.addEventListener 'blur', keyActAdd, true
input.addEventListener 'focus', keybindRem, true
input.addEventListener 'blur', keybindAdd, true
if not g.REPLY
#figure out which thread we're replying to
xpath = 'preceding::span[@class="postername"][1]/preceding::input[1]'
@ -965,9 +964,9 @@ if getConfig 'Keybinds'
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()
input.addEventListener 'focus', keybindRem, true
input.addEventListener 'blur', keybindAdd, true
keybindAdd()
if g.REPLY
if getConfig('Quick Reply') and getConfig 'Persistent QR'

View File

@ -1,5 +1,5 @@
(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, keyActAdd, keyActRem, 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, 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, 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, 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;
config = {
'Thread Hiding': [true, 'Hide entire threads'],
@ -264,7 +264,7 @@
var div;
div = this.parentNode.parentNode;
remove(div);
return keyActAdd();
return keybindAdd();
};
clearHidden = function() {
GM_deleteValue("hiddenReplies/" + (g.BOARD) + "/");
@ -349,7 +349,7 @@
recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) {
(typeof (_ref2 = ((_ref = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref2 === null) ? undefined : _ref2.click();
return keyActAdd();
return keybindAdd();
} else {
e.preventDefault();
span = n('span', {
@ -429,7 +429,7 @@
});
addTo(qr, span);
(typeof (_ref2 = ((_ref = $('input[title=autohide]:checked', qr)))) === "undefined" || _ref2 === null) ? undefined : _ref2.click();
keyActRem();
keybindRem();
} else if (g.REPLY && getConfig('Persistent QR')) {
$('textarea', qr).value = '';
$('input[name=recaptcha_response_field]', qr).value = '';
@ -446,6 +446,16 @@
}
return recaptchaReload();
};
keybindAdd = function() {
if (getConfig('Keybinds')) {
d.addEventListener('keydown', keydown, true);
return d.addEventListener('keypress', keypress, true);
}
};
keybindRem = function() {
d.removeEventListener('keydown', keydown, true);
return d.removeEventListener('keypress', keypress, true);
};
keypress = function(e) {
var _i, _len, char, count, hash, href, img, kc, position, qrLink, temp;
kc = g.keyCode;
@ -553,16 +563,6 @@
return (g.keyCode = kc);
}
};
keyActAdd = function() {
if (getConfig('Keybinds')) {
d.addEventListener('keydown', keydown, true);
return d.addEventListener('keypress', keypress, true);
}
};
keyActRem = function() {
d.removeEventListener('keydown', keydown, true);
return d.removeEventListener('keypress', keypress, true);
};
nodeInserted = function(e) {
var _i, _len, _ref, _result, callback, qr, target;
target = e.target;
@ -719,8 +719,8 @@
_ref = inputs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i];
input.addEventListener('focus', keyActRem, true);
input.addEventListener('blur', keyActAdd, true);
input.addEventListener('focus', keybindRem, true);
input.addEventListener('blur', keybindAdd, true);
}
}
if (!g.REPLY) {
@ -1249,10 +1249,10 @@
_ref = inputs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i];
input.addEventListener('focus', keyActRem, true);
input.addEventListener('blur', keyActAdd, true);
input.addEventListener('focus', keybindRem, true);
input.addEventListener('blur', keybindAdd, true);
}
keyActAdd();
keybindAdd();
}
if (g.REPLY) {
if (getConfig('Quick Reply') && getConfig('Persistent QR')) {