Release 4chan X v1.11.0.6.

This commit is contained in:
ccd0 2015-06-20 23:06:34 -07:00
parent 29fe77e7f6
commit c83b2167da
13 changed files with 270 additions and 216 deletions

View File

@ -4,6 +4,12 @@ The links to individual versions below are to copies of the script with the upda
## v1.11.0 ## v1.11.0
**v1.11.0.6** *(2015-06-20)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.6/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.6/builds/4chan-X-noupdate.crx "Chromium version")]
- Support toggling images in the captcha with the number keys (as arranged in the numpad) and the UIOJKLM,. keys.
- Arrow key navigation now works in noscript captcha.
- Various captcha-related improvements/bugfixes.
- Support space bar, numbers in numpad, comma, and space in keybinds.
**v1.11.0.5** *(2015-06-20)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.5/builds/4chan-X-noupdate.crx "Chromium version")] **v1.11.0.5** *(2015-06-20)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.5/builds/4chan-X-noupdate.crx "Chromium version")]
- Add `Captcha Language` setting in the `Advanced` panel. - Add `Captcha Language` setting in the `Advanced` panel.
- Minor bugfixes. - Minor bugfixes.

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.11.0.5 // @version 1.11.0.6
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.11.0.5 // @version 1.11.0.6
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -400,7 +400,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.0.5', VERSION: '1.11.0.6',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2057,7 +2057,7 @@
function Connection(target1, origin1, cb1) { function Connection(target1, origin1, cb1) {
this.target = target1; this.target = target1;
this.origin = origin1; this.origin = origin1;
this.cb = cb1; this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this); this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this); this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage); $.on(window, 'message', this.onMessage);
@ -6833,11 +6833,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement); QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus); QR.nodes.el.classList.toggle('focus', QR.hasFocus);
} }
if (QR.inCaptcha()) { if (QR.captcha.isEnabled && !QR.captcha.noscript) {
QR.scrollY = window.scrollY; if (QR.inCaptcha()) {
return $.on(d, 'scroll', QR.scrollLock); QR.scrollY = window.scrollY;
} else { return $.on(d, 'scroll', QR.scrollLock);
return $.off(d, 'scroll', QR.scrollLock); } else {
return $.off(d, 'scroll', QR.scrollLock);
}
} }
}); });
}, },
@ -7616,6 +7618,7 @@
Captcha = {}; Captcha = {};
Captcha.fixes = { Captcha.fixes = {
imageKeys: '789456123uiojklm'.split('').concat(['Comma', 'Period']),
css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}', css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}',
cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}', cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}',
init: function() { init: function() {
@ -7656,8 +7659,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this)); return $.on(d, 'keydown', this.keybinds.bind(this));
}, },
initNoscript: function() { initNoscript: function() {
this.noscript = true;
this.images = $$('.fbc-payload-imageselect > input');
if (!this.images.length) {
return;
}
$.addStyle(this.cssNoscript); $.addStyle(this.cssNoscript);
return this.addLabels(); this.addLabels();
$.on(d, 'keydown', this.keybinds.bind(this));
return $.on($('.fbc-imageselect-challenge > form'), 'submit', this.checkForm.bind(this));
}, },
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
@ -7667,13 +7677,16 @@
img = ref[k]; img = ref[k];
img.tabIndex = 0; img.tabIndex = 0;
} }
if (this.images.length) {
return this.addTooltips(this.images);
}
}, },
addLabels: function() { addLabels: function() {
var checkbox, i, imageSelect, label, labels; var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect'); imageSelect = $('.fbc-payload-imageselect');
labels = (function() { labels = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = $$('input', imageSelect); ref = this.images;
results = []; results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i]; checkbox = ref[i];
@ -7686,37 +7699,54 @@
results.push(label); results.push(label);
} }
return results; return results;
})(); }).call(this);
return $.add(imageSelect, labels); $.add(imageSelect, labels);
return this.addTooltips(labels);
},
addTooltips: function(nodes) {
var i, k, len1, node;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) {
node = nodes[i];
node.title = this.imageKeys[i] + " or " + (this.imageKeys[i + 9][0].toUpperCase()) + this.imageKeys[i + 9].slice(1);
}
},
checkForm: function(e) {
var checkbox, k, len1, n, ref;
n = 0;
ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) {
checkbox = ref[k];
if (checkbox.checked) {
n++;
}
}
if (n === 0) {
return e.preventDefault();
}
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, reload, verify, x; var dx, i, key, reload, verify, x;
if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
reload = $.id('recaptcha-reload-button'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $.id('recaptcha-verify-button'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement); x = this.images.indexOf(d.activeElement);
if (x < 0) { if (x < 0) {
if (!$('.rc-controls').contains(d.activeElement)) {
return;
}
x = d.activeElement === verify ? 11 : 9; x = d.activeElement === verify ? 11 : 9;
} }
if (e.keyCode === 32 && x < 9) { key = Keybinds.keyCode(e);
if (!this.noscript && key === 'Space' && x < 9) {
this.images[x].click(); this.images[x].click();
e.preventDefault(); } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
return e.stopPropagation(); this.images[i % 9].click();
verify.focus();
} else if (dx = { } else if (dx = {
38: 9, 'Up': 9,
40: 3, 'Down': 3,
37: 11, 'Left': 11,
39: 1, 'Right': 1
73: 9, }[key]) {
75: 3,
74: 11,
76: 1
}[e.keyCode]) {
x = (x + dx) % 12; x = (x + dx) % 12;
if (x === 10) { if (x === 10) {
x = dx === 11 ? 9 : 11; x = dx === 11 ? 9 : 11;
@ -7725,9 +7755,11 @@
9: reload, 9: reload,
11: verify 11: verify
}[x]).focus(); }[x]).focus();
e.preventDefault(); } else {
return e.stopPropagation(); return;
} }
e.preventDefault();
return e.stopPropagation();
} }
}; };
@ -7758,40 +7790,6 @@
} }
}; };
Captcha.noscript = {
initFrame: function() {
var cb, conn, img, ref, ref1;
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", {
response: function(response) {
$.id('response').value = response;
return $('.fbc-challenge > form').submit();
}
});
conn.send({
token: (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0,
error: (ref1 = $('.fbc-error')) != null ? ref1.textContent : void 0
});
if (!(img = $('.fbc-payload > img'))) {
return;
}
cb = function() {
var canvas;
canvas = $.el('canvas');
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0);
return conn.send({
challenge: canvas.toDataURL()
});
};
if (img.complete) {
return cb();
} else {
return $.on(img, 'load', cb);
}
}
};
Captcha.v2 = { Captcha.v2 = {
lifetime: 2 * $.MINUTE, lifetime: 2 * $.MINUTE,
init: function() { init: function() {
@ -7810,6 +7808,7 @@
}; };
})(this) })(this)
}); });
$.addClass(QR.nodes.el, 'noscript-captcha');
} }
this.captchas = []; this.captchas = [];
$.get('captchas', [], function(arg) { $.get('captchas', [], function(arg) {
@ -7841,6 +7840,15 @@
}; };
})(this)); })(this));
}, },
initFrame: function() {
var conn, ref, token;
if (token = (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0) {
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org");
return conn.send({
token: token
});
}
},
shouldFocus: false, shouldFocus: false,
timeouts: {}, timeouts: {},
postsCount: 0, postsCount: 0,
@ -8004,7 +8012,7 @@
} }
}, },
save: function(pasted, token) { save: function(pasted, token) {
var base1, focus, ref, ref1; var base1, focus, ref;
$.forceSync('captchas'); $.forceSync('captchas');
this.captchas.push({ this.captchas.push({
response: token || $('textarea', this.nodes.container).value, response: token || $('textarea', this.nodes.container).value,
@ -8012,7 +8020,7 @@
}); });
$.set('captchas', this.captchas); $.set('captchas', this.captchas);
this.count(); this.count();
focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && ((ref1 = d.activeElement.src) != null ? ref1.slice(0, 38) : void 0) === 'https://www.google.com/recaptcha/api2/'; focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src);
if (this.needed()) { if (this.needed()) {
if (focus) { if (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@ -14876,6 +14884,8 @@
return 'Enter'; return 'Enter';
case 27: case 27:
return 'Esc'; return 'Esc';
case 32:
return 'Space';
case 37: case 37:
return 'Left'; return 'Left';
case 38: case 38:
@ -14884,9 +14894,15 @@
return 'Right'; return 'Right';
case 40: case 40:
return 'Down'; return 'Down';
case 188:
return 'Comma';
case 190:
return 'Period';
default: default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) { if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase(); return String.fromCharCode(kc).toLowerCase();
} else if ((96 <= kc && kc <= 105)) {
return String.fromCharCode(kc - 48).toLowerCase();
} else { } else {
return null; return null;
} }
@ -16126,7 +16142,7 @@
if (location.hostname === 'www.google.com') { if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') { if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() { $.ready(function() {
return Captcha.noscript.initFrame(); return Captcha.v2.initFrame();
}); });
} }
$.get('Captcha Fixes', true, function(arg) { $.get('Captcha Fixes', true, function(arg) {

Binary file not shown.

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.11.0.5 // @version 1.11.0.6
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -399,7 +399,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.0.5', VERSION: '1.11.0.6',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2056,7 +2056,7 @@
function Connection(target1, origin1, cb1) { function Connection(target1, origin1, cb1) {
this.target = target1; this.target = target1;
this.origin = origin1; this.origin = origin1;
this.cb = cb1; this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this); this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this); this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage); $.on(window, 'message', this.onMessage);
@ -6832,11 +6832,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement); QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus); QR.nodes.el.classList.toggle('focus', QR.hasFocus);
} }
if (QR.inCaptcha()) { if (QR.captcha.isEnabled && !QR.captcha.noscript) {
QR.scrollY = window.scrollY; if (QR.inCaptcha()) {
return $.on(d, 'scroll', QR.scrollLock); QR.scrollY = window.scrollY;
} else { return $.on(d, 'scroll', QR.scrollLock);
return $.off(d, 'scroll', QR.scrollLock); } else {
return $.off(d, 'scroll', QR.scrollLock);
}
} }
}); });
}, },
@ -7615,6 +7617,7 @@
Captcha = {}; Captcha = {};
Captcha.fixes = { Captcha.fixes = {
imageKeys: '789456123uiojklm'.split('').concat(['Comma', 'Period']),
css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}', css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}',
cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}', cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}',
init: function() { init: function() {
@ -7655,8 +7658,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this)); return $.on(d, 'keydown', this.keybinds.bind(this));
}, },
initNoscript: function() { initNoscript: function() {
this.noscript = true;
this.images = $$('.fbc-payload-imageselect > input');
if (!this.images.length) {
return;
}
$.addStyle(this.cssNoscript); $.addStyle(this.cssNoscript);
return this.addLabels(); this.addLabels();
$.on(d, 'keydown', this.keybinds.bind(this));
return $.on($('.fbc-imageselect-challenge > form'), 'submit', this.checkForm.bind(this));
}, },
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
@ -7666,13 +7676,16 @@
img = ref[k]; img = ref[k];
img.tabIndex = 0; img.tabIndex = 0;
} }
if (this.images.length) {
return this.addTooltips(this.images);
}
}, },
addLabels: function() { addLabels: function() {
var checkbox, i, imageSelect, label, labels; var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect'); imageSelect = $('.fbc-payload-imageselect');
labels = (function() { labels = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = $$('input', imageSelect); ref = this.images;
results = []; results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i]; checkbox = ref[i];
@ -7685,37 +7698,54 @@
results.push(label); results.push(label);
} }
return results; return results;
})(); }).call(this);
return $.add(imageSelect, labels); $.add(imageSelect, labels);
return this.addTooltips(labels);
},
addTooltips: function(nodes) {
var i, k, len1, node;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) {
node = nodes[i];
node.title = this.imageKeys[i] + " or " + (this.imageKeys[i + 9][0].toUpperCase()) + this.imageKeys[i + 9].slice(1);
}
},
checkForm: function(e) {
var checkbox, k, len1, n, ref;
n = 0;
ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) {
checkbox = ref[k];
if (checkbox.checked) {
n++;
}
}
if (n === 0) {
return e.preventDefault();
}
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, reload, verify, x; var dx, i, key, reload, verify, x;
if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
reload = $.id('recaptcha-reload-button'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $.id('recaptcha-verify-button'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement); x = this.images.indexOf(d.activeElement);
if (x < 0) { if (x < 0) {
if (!$('.rc-controls').contains(d.activeElement)) {
return;
}
x = d.activeElement === verify ? 11 : 9; x = d.activeElement === verify ? 11 : 9;
} }
if (e.keyCode === 32 && x < 9) { key = Keybinds.keyCode(e);
if (!this.noscript && key === 'Space' && x < 9) {
this.images[x].click(); this.images[x].click();
e.preventDefault(); } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
return e.stopPropagation(); this.images[i % 9].click();
verify.focus();
} else if (dx = { } else if (dx = {
38: 9, 'Up': 9,
40: 3, 'Down': 3,
37: 11, 'Left': 11,
39: 1, 'Right': 1
73: 9, }[key]) {
75: 3,
74: 11,
76: 1
}[e.keyCode]) {
x = (x + dx) % 12; x = (x + dx) % 12;
if (x === 10) { if (x === 10) {
x = dx === 11 ? 9 : 11; x = dx === 11 ? 9 : 11;
@ -7724,9 +7754,11 @@
9: reload, 9: reload,
11: verify 11: verify
}[x]).focus(); }[x]).focus();
e.preventDefault(); } else {
return e.stopPropagation(); return;
} }
e.preventDefault();
return e.stopPropagation();
} }
}; };
@ -7757,40 +7789,6 @@
} }
}; };
Captcha.noscript = {
initFrame: function() {
var cb, conn, img, ref, ref1;
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", {
response: function(response) {
$.id('response').value = response;
return $('.fbc-challenge > form').submit();
}
});
conn.send({
token: (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0,
error: (ref1 = $('.fbc-error')) != null ? ref1.textContent : void 0
});
if (!(img = $('.fbc-payload > img'))) {
return;
}
cb = function() {
var canvas;
canvas = $.el('canvas');
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0);
return conn.send({
challenge: canvas.toDataURL()
});
};
if (img.complete) {
return cb();
} else {
return $.on(img, 'load', cb);
}
}
};
Captcha.v2 = { Captcha.v2 = {
lifetime: 2 * $.MINUTE, lifetime: 2 * $.MINUTE,
init: function() { init: function() {
@ -7809,6 +7807,7 @@
}; };
})(this) })(this)
}); });
$.addClass(QR.nodes.el, 'noscript-captcha');
} }
this.captchas = []; this.captchas = [];
$.get('captchas', [], function(arg) { $.get('captchas', [], function(arg) {
@ -7840,6 +7839,15 @@
}; };
})(this)); })(this));
}, },
initFrame: function() {
var conn, ref, token;
if (token = (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0) {
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org");
return conn.send({
token: token
});
}
},
shouldFocus: false, shouldFocus: false,
timeouts: {}, timeouts: {},
postsCount: 0, postsCount: 0,
@ -8003,7 +8011,7 @@
} }
}, },
save: function(pasted, token) { save: function(pasted, token) {
var base1, focus, ref, ref1; var base1, focus, ref;
$.forceSync('captchas'); $.forceSync('captchas');
this.captchas.push({ this.captchas.push({
response: token || $('textarea', this.nodes.container).value, response: token || $('textarea', this.nodes.container).value,
@ -8011,7 +8019,7 @@
}); });
$.set('captchas', this.captchas); $.set('captchas', this.captchas);
this.count(); this.count();
focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && ((ref1 = d.activeElement.src) != null ? ref1.slice(0, 38) : void 0) === 'https://www.google.com/recaptcha/api2/'; focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src);
if (this.needed()) { if (this.needed()) {
if (focus) { if (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@ -14875,6 +14883,8 @@
return 'Enter'; return 'Enter';
case 27: case 27:
return 'Esc'; return 'Esc';
case 32:
return 'Space';
case 37: case 37:
return 'Left'; return 'Left';
case 38: case 38:
@ -14883,9 +14893,15 @@
return 'Right'; return 'Right';
case 40: case 40:
return 'Down'; return 'Down';
case 188:
return 'Comma';
case 190:
return 'Period';
default: default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) { if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase(); return String.fromCharCode(kc).toLowerCase();
} else if ((96 <= kc && kc <= 105)) {
return String.fromCharCode(kc - 48).toLowerCase();
} else { } else {
return null; return null;
} }
@ -16125,7 +16141,7 @@
if (location.hostname === 'www.google.com') { if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') { if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() { $.ready(function() {
return Captcha.noscript.initFrame(); return Captcha.v2.initFrame();
}); });
} }
$.get('Captcha Fixes', true, function(arg) { $.get('Captcha Fixes', true, function(arg) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.11.0.5 // @version 1.11.0.6
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.11.0.5 // @version 1.11.0.6
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -400,7 +400,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.0.5', VERSION: '1.11.0.6',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2057,7 +2057,7 @@
function Connection(target1, origin1, cb1) { function Connection(target1, origin1, cb1) {
this.target = target1; this.target = target1;
this.origin = origin1; this.origin = origin1;
this.cb = cb1; this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this); this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this); this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage); $.on(window, 'message', this.onMessage);
@ -6833,11 +6833,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement); QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus); QR.nodes.el.classList.toggle('focus', QR.hasFocus);
} }
if (QR.inCaptcha()) { if (QR.captcha.isEnabled && !QR.captcha.noscript) {
QR.scrollY = window.scrollY; if (QR.inCaptcha()) {
return $.on(d, 'scroll', QR.scrollLock); QR.scrollY = window.scrollY;
} else { return $.on(d, 'scroll', QR.scrollLock);
return $.off(d, 'scroll', QR.scrollLock); } else {
return $.off(d, 'scroll', QR.scrollLock);
}
} }
}); });
}, },
@ -7616,6 +7618,7 @@
Captcha = {}; Captcha = {};
Captcha.fixes = { Captcha.fixes = {
imageKeys: '789456123uiojklm'.split('').concat(['Comma', 'Period']),
css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}', css: '.rc-imageselect-target > div:focus {\n outline: 2px solid #4a90e2;\n}\n.rc-button-default:focus {\n box-shadow: inset 0 0 0 2px #0063d6;\n}',
cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}', cssNoscript: '.fbc-payload-imageselect {\n position: relative;\n}\n.fbc-payload-imageselect > label {\n position: absolute;\n display: block;\n height: 93.3px;\n width: 93.3px;\n}\nlabel[data-row="0"] {top: 0px;}\nlabel[data-row="1"] {top: 93.3px;}\nlabel[data-row="2"] {top: 186.6px;}\nlabel[data-col="0"] {left: 0px;}\nlabel[data-col="1"] {left: 93.3px;}\nlabel[data-col="2"] {left: 186.6px;}',
init: function() { init: function() {
@ -7656,8 +7659,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this)); return $.on(d, 'keydown', this.keybinds.bind(this));
}, },
initNoscript: function() { initNoscript: function() {
this.noscript = true;
this.images = $$('.fbc-payload-imageselect > input');
if (!this.images.length) {
return;
}
$.addStyle(this.cssNoscript); $.addStyle(this.cssNoscript);
return this.addLabels(); this.addLabels();
$.on(d, 'keydown', this.keybinds.bind(this));
return $.on($('.fbc-imageselect-challenge > form'), 'submit', this.checkForm.bind(this));
}, },
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
@ -7667,13 +7677,16 @@
img = ref[k]; img = ref[k];
img.tabIndex = 0; img.tabIndex = 0;
} }
if (this.images.length) {
return this.addTooltips(this.images);
}
}, },
addLabels: function() { addLabels: function() {
var checkbox, i, imageSelect, label, labels; var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect'); imageSelect = $('.fbc-payload-imageselect');
labels = (function() { labels = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = $$('input', imageSelect); ref = this.images;
results = []; results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i]; checkbox = ref[i];
@ -7686,37 +7699,54 @@
results.push(label); results.push(label);
} }
return results; return results;
})(); }).call(this);
return $.add(imageSelect, labels); $.add(imageSelect, labels);
return this.addTooltips(labels);
},
addTooltips: function(nodes) {
var i, k, len1, node;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) {
node = nodes[i];
node.title = this.imageKeys[i] + " or " + (this.imageKeys[i + 9][0].toUpperCase()) + this.imageKeys[i + 9].slice(1);
}
},
checkForm: function(e) {
var checkbox, k, len1, n, ref;
n = 0;
ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) {
checkbox = ref[k];
if (checkbox.checked) {
n++;
}
}
if (n === 0) {
return e.preventDefault();
}
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, reload, verify, x; var dx, i, key, reload, verify, x;
if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
reload = $.id('recaptcha-reload-button'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $.id('recaptcha-verify-button'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement); x = this.images.indexOf(d.activeElement);
if (x < 0) { if (x < 0) {
if (!$('.rc-controls').contains(d.activeElement)) {
return;
}
x = d.activeElement === verify ? 11 : 9; x = d.activeElement === verify ? 11 : 9;
} }
if (e.keyCode === 32 && x < 9) { key = Keybinds.keyCode(e);
if (!this.noscript && key === 'Space' && x < 9) {
this.images[x].click(); this.images[x].click();
e.preventDefault(); } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
return e.stopPropagation(); this.images[i % 9].click();
verify.focus();
} else if (dx = { } else if (dx = {
38: 9, 'Up': 9,
40: 3, 'Down': 3,
37: 11, 'Left': 11,
39: 1, 'Right': 1
73: 9, }[key]) {
75: 3,
74: 11,
76: 1
}[e.keyCode]) {
x = (x + dx) % 12; x = (x + dx) % 12;
if (x === 10) { if (x === 10) {
x = dx === 11 ? 9 : 11; x = dx === 11 ? 9 : 11;
@ -7725,9 +7755,11 @@
9: reload, 9: reload,
11: verify 11: verify
}[x]).focus(); }[x]).focus();
e.preventDefault(); } else {
return e.stopPropagation(); return;
} }
e.preventDefault();
return e.stopPropagation();
} }
}; };
@ -7758,40 +7790,6 @@
} }
}; };
Captcha.noscript = {
initFrame: function() {
var cb, conn, img, ref, ref1;
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", {
response: function(response) {
$.id('response').value = response;
return $('.fbc-challenge > form').submit();
}
});
conn.send({
token: (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0,
error: (ref1 = $('.fbc-error')) != null ? ref1.textContent : void 0
});
if (!(img = $('.fbc-payload > img'))) {
return;
}
cb = function() {
var canvas;
canvas = $.el('canvas');
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0);
return conn.send({
challenge: canvas.toDataURL()
});
};
if (img.complete) {
return cb();
} else {
return $.on(img, 'load', cb);
}
}
};
Captcha.v2 = { Captcha.v2 = {
lifetime: 2 * $.MINUTE, lifetime: 2 * $.MINUTE,
init: function() { init: function() {
@ -7810,6 +7808,7 @@
}; };
})(this) })(this)
}); });
$.addClass(QR.nodes.el, 'noscript-captcha');
} }
this.captchas = []; this.captchas = [];
$.get('captchas', [], function(arg) { $.get('captchas', [], function(arg) {
@ -7841,6 +7840,15 @@
}; };
})(this)); })(this));
}, },
initFrame: function() {
var conn, ref, token;
if (token = (ref = $('.fbc-verification-token > textarea')) != null ? ref.value : void 0) {
conn = new Connection(window.parent, location.protocol + "//boards.4chan.org");
return conn.send({
token: token
});
}
},
shouldFocus: false, shouldFocus: false,
timeouts: {}, timeouts: {},
postsCount: 0, postsCount: 0,
@ -8004,7 +8012,7 @@
} }
}, },
save: function(pasted, token) { save: function(pasted, token) {
var base1, focus, ref, ref1; var base1, focus, ref;
$.forceSync('captchas'); $.forceSync('captchas');
this.captchas.push({ this.captchas.push({
response: token || $('textarea', this.nodes.container).value, response: token || $('textarea', this.nodes.container).value,
@ -8012,7 +8020,7 @@
}); });
$.set('captchas', this.captchas); $.set('captchas', this.captchas);
this.count(); this.count();
focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && ((ref1 = d.activeElement.src) != null ? ref1.slice(0, 38) : void 0) === 'https://www.google.com/recaptcha/api2/'; focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src);
if (this.needed()) { if (this.needed()) {
if (focus) { if (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@ -14876,6 +14884,8 @@
return 'Enter'; return 'Enter';
case 27: case 27:
return 'Esc'; return 'Esc';
case 32:
return 'Space';
case 37: case 37:
return 'Left'; return 'Left';
case 38: case 38:
@ -14884,9 +14894,15 @@
return 'Right'; return 'Right';
case 40: case 40:
return 'Down'; return 'Down';
case 188:
return 'Comma';
case 190:
return 'Period';
default: default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) { if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase(); return String.fromCharCode(kc).toLowerCase();
} else if ((96 <= kc && kc <= 105)) {
return String.fromCharCode(kc - 48).toLowerCase();
} else { } else {
return null; return null;
} }
@ -16126,7 +16142,7 @@
if (location.hostname === 'www.google.com') { if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') { if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() { $.ready(function() {
return Captcha.noscript.initFrame(); return Captcha.v2.initFrame();
}); });
} }
$.get('Captcha Fixes', true, function(arg) { $.get('Captcha Fixes', true, function(arg) {

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.11.0.5' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.11.0.6' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.11.0.5' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.11.0.6' />
</app> </app>
</gupdate> </gupdate>

View File

@ -3,8 +3,8 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.", "description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": { "meta": {
"name": "4chan X", "name": "4chan X",
"version": "1.11.0.5", "version": "1.11.0.6",
"date": "2015-06-21T00:33:27.540Z", "date": "2015-06-21T06:05:51.745Z",
"repo": "https://github.com/ccd0/4chan-x/", "repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x", "page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/", "downloads": "https://ccd0.github.io/4chan-x/builds/",