better mode switching
This commit is contained in:
parent
dc3363a344
commit
a006a8fa15
@ -206,8 +206,6 @@ autoWatch = ->
|
||||
closeQR = ->
|
||||
div = this.parentNode.parentNode
|
||||
remove div
|
||||
if not g.REPLY and getConfig 'Keyboard Actions'
|
||||
d.addEventListener 'keydown', keyAct, true
|
||||
|
||||
clearHidden = ->
|
||||
#'hidden' might be misleading; it's the number of IDs we're *looking* for,
|
||||
@ -364,10 +362,9 @@ iframeLoad = ->
|
||||
$('input[title=autohide]:checked', qr)?.click()
|
||||
else
|
||||
remove qr
|
||||
if not g.REPLY and getConfig 'Keyboard Actions'
|
||||
d.addEventListener 'keydown', keyAct, true
|
||||
recaptchaReload()
|
||||
|
||||
|
||||
keyAct = (e) ->
|
||||
kc = e.keyCode
|
||||
#https://developer.mozilla.org/en/DOM/Event/UIEvent/KeyEvent
|
||||
@ -427,6 +424,12 @@ keyAct = (e) ->
|
||||
GM_openInTab href
|
||||
g.count = 0
|
||||
|
||||
keyActAdd = ->
|
||||
d.addEventListener 'keydown', keyAct, true
|
||||
|
||||
keyActRem = ->
|
||||
d.removeEventListener 'keydown', keyAct, true
|
||||
|
||||
nodeInserted = (e) ->
|
||||
target = e.target
|
||||
if target.nodeName is 'TABLE'
|
||||
@ -504,7 +507,6 @@ parseResponse = (responseText) ->
|
||||
|
||||
quickReply = (e) ->
|
||||
unless qr = $ '#qr'
|
||||
d.removeEventListener 'keydown', keyAct, true
|
||||
#make quick reply dialog
|
||||
qr = AEOS.makeDialog 'qr', 'topleft'
|
||||
titlebar = n 'div',
|
||||
@ -541,6 +543,11 @@ quickReply = (e) ->
|
||||
name: 'resto'
|
||||
value: x(xpath, this).name
|
||||
addTo clone, input
|
||||
if getConfig 'Keyboard Actions'
|
||||
inputs = $$ 'input[type=text], textarea', clone
|
||||
for input in inputs
|
||||
input.addEventListener 'focus', keyActRem, true
|
||||
input.addEventListener 'blur', keyActAdd, true
|
||||
else if getConfig 'Persistent QR'
|
||||
submit = $ 'input[type=submit]', clone
|
||||
auto = n 'label',
|
||||
@ -948,7 +955,12 @@ if g.REPLY
|
||||
|
||||
else #not reply
|
||||
if getConfig 'Keyboard Actions'
|
||||
d.addEventListener 'keydown', keyAct, true
|
||||
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]')
|
||||
|
||||
36
4chan_x.js
36
4chan_x.js
@ -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, formSubmit, g, getConfig, getTime, hide, hideReply, hideThread, href, html, id, iframe, iframeLoad, inAfter, inBefore, inputs, keyAct, 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, keyAct, keyActAdd, keyActRem, 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'],
|
||||
@ -271,8 +271,7 @@
|
||||
closeQR = function() {
|
||||
var div;
|
||||
div = this.parentNode.parentNode;
|
||||
remove(div);
|
||||
return !g.REPLY && getConfig('Keyboard Actions') ? d.addEventListener('keydown', keyAct, true) : null;
|
||||
return remove(div);
|
||||
};
|
||||
clearHidden = function() {
|
||||
GM_deleteValue("hiddenReplies/" + (g.BOARD) + "/");
|
||||
@ -449,9 +448,6 @@
|
||||
}
|
||||
} else {
|
||||
remove(qr);
|
||||
if (!g.REPLY && getConfig('Keyboard Actions')) {
|
||||
d.addEventListener('keydown', keyAct, true);
|
||||
}
|
||||
}
|
||||
return recaptchaReload();
|
||||
};
|
||||
@ -538,6 +534,12 @@
|
||||
}
|
||||
return (g.count = 0);
|
||||
};
|
||||
keyActAdd = function() {
|
||||
return d.addEventListener('keydown', keyAct, true);
|
||||
};
|
||||
keyActRem = function() {
|
||||
return d.removeEventListener('keydown', keyAct, true);
|
||||
};
|
||||
nodeInserted = function(e) {
|
||||
var _i, _len, _ref, _result, callback, qr, target;
|
||||
target = e.target;
|
||||
@ -653,9 +655,8 @@
|
||||
return [replies, opbq];
|
||||
};
|
||||
quickReply = function(e) {
|
||||
var _i, _len, _ref, _ref2, auto, autoBox, autohideB, clone, closeB, form, id, input, qr, script, selection, submit, text, textarea, titlebar, xpath;
|
||||
var _i, _len, _ref, _ref2, auto, autoBox, autohideB, clone, closeB, form, id, input, inputs, qr, script, selection, submit, text, textarea, titlebar, xpath;
|
||||
if (!(qr = $('#qr'))) {
|
||||
d.removeEventListener('keydown', keyAct, true);
|
||||
qr = AEOS.makeDialog('qr', 'topleft');
|
||||
titlebar = n('div', {
|
||||
innerHTML: 'Quick Reply ',
|
||||
@ -698,6 +699,15 @@
|
||||
value: x(xpath, this).name
|
||||
});
|
||||
addTo(clone, input);
|
||||
if (getConfig('Keyboard Actions')) {
|
||||
inputs = $$('input[type=text], textarea', clone);
|
||||
_ref = inputs;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
input = _ref[_i];
|
||||
input.addEventListener('focus', keyActRem, true);
|
||||
input.addEventListener('blur', keyActAdd, true);
|
||||
}
|
||||
}
|
||||
} else if (getConfig('Persistent QR')) {
|
||||
submit = $('input[type=submit]', clone);
|
||||
auto = n('label', {
|
||||
@ -1224,7 +1234,15 @@
|
||||
}
|
||||
} else {
|
||||
if (getConfig('Keyboard Actions')) {
|
||||
d.addEventListener('keydown', keyAct, true);
|
||||
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]');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user