diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0437ddba..4379584f7 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.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")]
- Add `Captcha Language` setting in the `Advanced` panel.
- Minor bugfixes.
diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx
index 360b967ac..9bfbaa0d9 100644
Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ
diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js
index 0b64f4089..6b927ebda 100644
--- a/builds/4chan-X-beta.meta.js
+++ b/builds/4chan-X-beta.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
-// @version 1.11.0.5
+// @version 1.11.0.6
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js
index 1d2753046..bd2c64c83 100644
--- a/builds/4chan-X-beta.user.js
+++ b/builds/4chan-X-beta.user.js
@@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X beta
-// @version 1.11.0.5
+// @version 1.11.0.6
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -400,7 +400,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.11.0.5',
+ VERSION: '1.11.0.6',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -2057,7 +2057,7 @@
function Connection(target1, origin1, cb1) {
this.target = target1;
this.origin = origin1;
- this.cb = cb1;
+ this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage);
@@ -6833,11 +6833,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus);
}
- if (QR.inCaptcha()) {
- QR.scrollY = window.scrollY;
- return $.on(d, 'scroll', QR.scrollLock);
- } else {
- return $.off(d, 'scroll', QR.scrollLock);
+ if (QR.captcha.isEnabled && !QR.captcha.noscript) {
+ if (QR.inCaptcha()) {
+ QR.scrollY = window.scrollY;
+ return $.on(d, 'scroll', QR.scrollLock);
+ } else {
+ return $.off(d, 'scroll', QR.scrollLock);
+ }
}
});
},
@@ -7616,6 +7618,7 @@
Captcha = {};
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}',
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() {
@@ -7656,8 +7659,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this));
},
initNoscript: function() {
+ this.noscript = true;
+ this.images = $$('.fbc-payload-imageselect > input');
+ if (!this.images.length) {
+ return;
+ }
$.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() {
var img, k, len1, ref;
@@ -7667,13 +7677,16 @@
img = ref[k];
img.tabIndex = 0;
}
+ if (this.images.length) {
+ return this.addTooltips(this.images);
+ }
},
addLabels: function() {
var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect');
labels = (function() {
var k, len1, ref, results;
- ref = $$('input', imageSelect);
+ ref = this.images;
results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i];
@@ -7686,37 +7699,54 @@
results.push(label);
}
return results;
- })();
- return $.add(imageSelect, labels);
+ }).call(this);
+ $.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) {
- var dx, reload, verify, x;
- if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) {
+ var dx, i, key, reload, verify, x;
+ if (!(this.images && doc.contains(this.images[0]))) {
return;
}
- reload = $.id('recaptcha-reload-button');
- verify = $.id('recaptcha-verify-button');
+ reload = $('#recaptcha-reload-button, .fbc-button-reload');
+ verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement);
if (x < 0) {
- if (!$('.rc-controls').contains(d.activeElement)) {
- return;
- }
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();
- e.preventDefault();
- return e.stopPropagation();
+ } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
+ this.images[i % 9].click();
+ verify.focus();
} else if (dx = {
- 38: 9,
- 40: 3,
- 37: 11,
- 39: 1,
- 73: 9,
- 75: 3,
- 74: 11,
- 76: 1
- }[e.keyCode]) {
+ 'Up': 9,
+ 'Down': 3,
+ 'Left': 11,
+ 'Right': 1
+ }[key]) {
x = (x + dx) % 12;
if (x === 10) {
x = dx === 11 ? 9 : 11;
@@ -7725,9 +7755,11 @@
9: reload,
11: verify
}[x]).focus();
- e.preventDefault();
- return e.stopPropagation();
+ } else {
+ 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 = {
lifetime: 2 * $.MINUTE,
init: function() {
@@ -7810,6 +7808,7 @@
};
})(this)
});
+ $.addClass(QR.nodes.el, 'noscript-captcha');
}
this.captchas = [];
$.get('captchas', [], function(arg) {
@@ -7841,6 +7840,15 @@
};
})(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,
timeouts: {},
postsCount: 0,
@@ -8004,7 +8012,7 @@
}
},
save: function(pasted, token) {
- var base1, focus, ref, ref1;
+ var base1, focus, ref;
$.forceSync('captchas');
this.captchas.push({
response: token || $('textarea', this.nodes.container).value,
@@ -8012,7 +8020,7 @@
});
$.set('captchas', this.captchas);
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 (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@@ -14876,6 +14884,8 @@
return 'Enter';
case 27:
return 'Esc';
+ case 32:
+ return 'Space';
case 37:
return 'Left';
case 38:
@@ -14884,9 +14894,15 @@
return 'Right';
case 40:
return 'Down';
+ case 188:
+ return 'Comma';
+ case 190:
+ return 'Period';
default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase();
+ } else if ((96 <= kc && kc <= 105)) {
+ return String.fromCharCode(kc - 48).toLowerCase();
} else {
return null;
}
@@ -16126,7 +16142,7 @@
if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() {
- return Captcha.noscript.initFrame();
+ return Captcha.v2.initFrame();
});
}
$.get('Captcha Fixes', true, function(arg) {
diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx
index b4c677b2a..c0da5c73a 100644
Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ
diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js
index 924317734..af7e124d4 100644
--- a/builds/4chan-X-noupdate.user.js
+++ b/builds/4chan-X-noupdate.user.js
@@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
-// @version 1.11.0.5
+// @version 1.11.0.6
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -399,7 +399,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.11.0.5',
+ VERSION: '1.11.0.6',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -2056,7 +2056,7 @@
function Connection(target1, origin1, cb1) {
this.target = target1;
this.origin = origin1;
- this.cb = cb1;
+ this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage);
@@ -6832,11 +6832,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus);
}
- if (QR.inCaptcha()) {
- QR.scrollY = window.scrollY;
- return $.on(d, 'scroll', QR.scrollLock);
- } else {
- return $.off(d, 'scroll', QR.scrollLock);
+ if (QR.captcha.isEnabled && !QR.captcha.noscript) {
+ if (QR.inCaptcha()) {
+ QR.scrollY = window.scrollY;
+ return $.on(d, 'scroll', QR.scrollLock);
+ } else {
+ return $.off(d, 'scroll', QR.scrollLock);
+ }
}
});
},
@@ -7615,6 +7617,7 @@
Captcha = {};
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}',
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() {
@@ -7655,8 +7658,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this));
},
initNoscript: function() {
+ this.noscript = true;
+ this.images = $$('.fbc-payload-imageselect > input');
+ if (!this.images.length) {
+ return;
+ }
$.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() {
var img, k, len1, ref;
@@ -7666,13 +7676,16 @@
img = ref[k];
img.tabIndex = 0;
}
+ if (this.images.length) {
+ return this.addTooltips(this.images);
+ }
},
addLabels: function() {
var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect');
labels = (function() {
var k, len1, ref, results;
- ref = $$('input', imageSelect);
+ ref = this.images;
results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i];
@@ -7685,37 +7698,54 @@
results.push(label);
}
return results;
- })();
- return $.add(imageSelect, labels);
+ }).call(this);
+ $.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) {
- var dx, reload, verify, x;
- if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) {
+ var dx, i, key, reload, verify, x;
+ if (!(this.images && doc.contains(this.images[0]))) {
return;
}
- reload = $.id('recaptcha-reload-button');
- verify = $.id('recaptcha-verify-button');
+ reload = $('#recaptcha-reload-button, .fbc-button-reload');
+ verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement);
if (x < 0) {
- if (!$('.rc-controls').contains(d.activeElement)) {
- return;
- }
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();
- e.preventDefault();
- return e.stopPropagation();
+ } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
+ this.images[i % 9].click();
+ verify.focus();
} else if (dx = {
- 38: 9,
- 40: 3,
- 37: 11,
- 39: 1,
- 73: 9,
- 75: 3,
- 74: 11,
- 76: 1
- }[e.keyCode]) {
+ 'Up': 9,
+ 'Down': 3,
+ 'Left': 11,
+ 'Right': 1
+ }[key]) {
x = (x + dx) % 12;
if (x === 10) {
x = dx === 11 ? 9 : 11;
@@ -7724,9 +7754,11 @@
9: reload,
11: verify
}[x]).focus();
- e.preventDefault();
- return e.stopPropagation();
+ } else {
+ 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 = {
lifetime: 2 * $.MINUTE,
init: function() {
@@ -7809,6 +7807,7 @@
};
})(this)
});
+ $.addClass(QR.nodes.el, 'noscript-captcha');
}
this.captchas = [];
$.get('captchas', [], function(arg) {
@@ -7840,6 +7839,15 @@
};
})(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,
timeouts: {},
postsCount: 0,
@@ -8003,7 +8011,7 @@
}
},
save: function(pasted, token) {
- var base1, focus, ref, ref1;
+ var base1, focus, ref;
$.forceSync('captchas');
this.captchas.push({
response: token || $('textarea', this.nodes.container).value,
@@ -8011,7 +8019,7 @@
});
$.set('captchas', this.captchas);
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 (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@@ -14875,6 +14883,8 @@
return 'Enter';
case 27:
return 'Esc';
+ case 32:
+ return 'Space';
case 37:
return 'Left';
case 38:
@@ -14883,9 +14893,15 @@
return 'Right';
case 40:
return 'Down';
+ case 188:
+ return 'Comma';
+ case 190:
+ return 'Period';
default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase();
+ } else if ((96 <= kc && kc <= 105)) {
+ return String.fromCharCode(kc - 48).toLowerCase();
} else {
return null;
}
@@ -16125,7 +16141,7 @@
if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() {
- return Captcha.noscript.initFrame();
+ return Captcha.v2.initFrame();
});
}
$.get('Captcha Fixes', true, function(arg) {
diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx
index d5fa497a5..55623a0c3 100644
Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ
diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js
index 511f18ea4..f5f8087d6 100644
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.11.0.5
+// @version 1.11.0.6
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index bc3b9718c..b9841fb38 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
-// @version 1.11.0.5
+// @version 1.11.0.6
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -400,7 +400,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.11.0.5',
+ VERSION: '1.11.0.6',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -2057,7 +2057,7 @@
function Connection(target1, origin1, cb1) {
this.target = target1;
this.origin = origin1;
- this.cb = cb1;
+ this.cb = cb1 != null ? cb1 : {};
this.onMessage = bind(this.onMessage, this);
this.send = bind(this.send, this);
$.on(window, 'message', this.onMessage);
@@ -6833,11 +6833,13 @@
QR.hasFocus = d.activeElement && QR.nodes.el.contains(d.activeElement);
QR.nodes.el.classList.toggle('focus', QR.hasFocus);
}
- if (QR.inCaptcha()) {
- QR.scrollY = window.scrollY;
- return $.on(d, 'scroll', QR.scrollLock);
- } else {
- return $.off(d, 'scroll', QR.scrollLock);
+ if (QR.captcha.isEnabled && !QR.captcha.noscript) {
+ if (QR.inCaptcha()) {
+ QR.scrollY = window.scrollY;
+ return $.on(d, 'scroll', QR.scrollLock);
+ } else {
+ return $.off(d, 'scroll', QR.scrollLock);
+ }
}
});
},
@@ -7616,6 +7618,7 @@
Captcha = {};
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}',
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() {
@@ -7656,8 +7659,15 @@
return $.on(d, 'keydown', this.keybinds.bind(this));
},
initNoscript: function() {
+ this.noscript = true;
+ this.images = $$('.fbc-payload-imageselect > input');
+ if (!this.images.length) {
+ return;
+ }
$.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() {
var img, k, len1, ref;
@@ -7667,13 +7677,16 @@
img = ref[k];
img.tabIndex = 0;
}
+ if (this.images.length) {
+ return this.addTooltips(this.images);
+ }
},
addLabels: function() {
var checkbox, i, imageSelect, label, labels;
imageSelect = $('.fbc-payload-imageselect');
labels = (function() {
var k, len1, ref, results;
- ref = $$('input', imageSelect);
+ ref = this.images;
results = [];
for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
checkbox = ref[i];
@@ -7686,37 +7699,54 @@
results.push(label);
}
return results;
- })();
- return $.add(imageSelect, labels);
+ }).call(this);
+ $.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) {
- var dx, reload, verify, x;
- if (!(this.images && doc.contains(this.images[0]) && d.activeElement)) {
+ var dx, i, key, reload, verify, x;
+ if (!(this.images && doc.contains(this.images[0]))) {
return;
}
- reload = $.id('recaptcha-reload-button');
- verify = $.id('recaptcha-verify-button');
+ reload = $('#recaptcha-reload-button, .fbc-button-reload');
+ verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
x = this.images.indexOf(d.activeElement);
if (x < 0) {
- if (!$('.rc-controls').contains(d.activeElement)) {
- return;
- }
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();
- e.preventDefault();
- return e.stopPropagation();
+ } else if ((i = this.imageKeys.indexOf(key)) >= 0) {
+ this.images[i % 9].click();
+ verify.focus();
} else if (dx = {
- 38: 9,
- 40: 3,
- 37: 11,
- 39: 1,
- 73: 9,
- 75: 3,
- 74: 11,
- 76: 1
- }[e.keyCode]) {
+ 'Up': 9,
+ 'Down': 3,
+ 'Left': 11,
+ 'Right': 1
+ }[key]) {
x = (x + dx) % 12;
if (x === 10) {
x = dx === 11 ? 9 : 11;
@@ -7725,9 +7755,11 @@
9: reload,
11: verify
}[x]).focus();
- e.preventDefault();
- return e.stopPropagation();
+ } else {
+ 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 = {
lifetime: 2 * $.MINUTE,
init: function() {
@@ -7810,6 +7808,7 @@
};
})(this)
});
+ $.addClass(QR.nodes.el, 'noscript-captcha');
}
this.captchas = [];
$.get('captchas', [], function(arg) {
@@ -7841,6 +7840,15 @@
};
})(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,
timeouts: {},
postsCount: 0,
@@ -8004,7 +8012,7 @@
}
},
save: function(pasted, token) {
- var base1, focus, ref, ref1;
+ var base1, focus, ref;
$.forceSync('captchas');
this.captchas.push({
response: token || $('textarea', this.nodes.container).value,
@@ -8012,7 +8020,7 @@
});
$.set('captchas', this.captchas);
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 (focus) {
if (QR.cooldown.auto || Conf['Post on Captcha Completion']) {
@@ -14876,6 +14884,8 @@
return 'Enter';
case 27:
return 'Esc';
+ case 32:
+ return 'Space';
case 37:
return 'Left';
case 38:
@@ -14884,9 +14894,15 @@
return 'Right';
case 40:
return 'Down';
+ case 188:
+ return 'Comma';
+ case 190:
+ return 'Period';
default:
if ((48 <= kc && kc <= 57) || (65 <= kc && kc <= 90)) {
return String.fromCharCode(kc).toLowerCase();
+ } else if ((96 <= kc && kc <= 105)) {
+ return String.fromCharCode(kc - 48).toLowerCase();
} else {
return null;
}
@@ -16126,7 +16142,7 @@
if (location.hostname === 'www.google.com') {
if (location.pathname === '/recaptcha/api/fallback') {
$.ready(function() {
- return Captcha.noscript.initFrame();
+ return Captcha.v2.initFrame();
});
}
$.get('Captcha Fixes', true, function(arg) {
diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip
index 3e81d4426..32aaa06aa 100644
Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ
diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml
index 53ff98466..a4e215c31 100644
--- a/builds/updates-beta.xml
+++ b/builds/updates-beta.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/builds/updates.xml b/builds/updates.xml
index 42e4a2d40..c9952f5c6 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/package.json b/package.json
index 0ab98fe68..150be93eb 100755
--- a/package.json
+++ b/package.json
@@ -3,8 +3,8 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",
- "version": "1.11.0.5",
- "date": "2015-06-21T00:33:27.540Z",
+ "version": "1.11.0.6",
+ "date": "2015-06-21T06:05:51.745Z",
"repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/",