Merge branch 'captcha'

This commit is contained in:
ccd0 2016-02-11 01:18:55 -08:00
commit 5ed3b67a16
14 changed files with 72 additions and 49 deletions

View File

@ -2,6 +2,12 @@
Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0). Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0).
### v1.11.25
**v1.11.25.0** *(2016-02-11)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.25.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.25.0/builds/4chan-X-noupdate.crx "Chromium version")]
- Based on v1.11.24.2.
- Support new 2x4 image captcha.
### v1.11.24 ### v1.11.24
**v1.11.24.2** *(2016-02-08)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.2/builds/4chan-X-noupdate.crx "Chromium version")] **v1.11.24.2** *(2016-02-08)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.2/builds/4chan-X-noupdate.crx "Chromium version")]

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.11.24.2 // @version 1.11.25.0
// @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.24.2 // @version 1.11.25.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -436,7 +436,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.24.2', VERSION: '1.11.25.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -8028,6 +8028,7 @@
return d.body.classList.toggle('focus', d.hasFocus()); return d.body.classList.toggle('focus', d.hasFocus());
}); });
this.images = $$('.fbc-payload-imageselect > input'); this.images = $$('.fbc-payload-imageselect > input');
this.width = 3;
if (this.images.length !== 9) { if (this.images.length !== 9) {
return; return;
} }
@ -8039,6 +8040,7 @@
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td'); this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td');
this.width = $$('.rc-imageselect-target tr:first-of-type td').length || Math.round(Math.sqrt(this.images.length));
ref = this.images; ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
img = ref[k]; img = ref[k];
@ -8046,8 +8048,7 @@
} }
if (this.images.length === 9) { if (this.images.length === 9) {
this.addTooltips(this.images); this.addTooltips(this.images);
} } else {
if (this.images.length === 16) {
this.addTooltips16(this.images); this.addTooltips16(this.images);
} }
return this.complaintLinks(); return this.complaintLinks();
@ -8097,10 +8098,13 @@
} }
}, },
addTooltips16: function(nodes) { addTooltips16: function(nodes) {
var i, k, len1, node; var i, k, key, len1, node, ref;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) { ref = this.imageKeys16;
node = nodes[i]; for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
node.title = "" + (this.imageKeys16[i][0].toUpperCase()) + this.imageKeys16[i].slice(1); key = ref[i];
if ((node = nodes[(Math.floor(i / 4)) * this.width + (i % 4)])) {
node.title = "" + (key[0].toUpperCase()) + key.slice(1);
}
} }
}, },
checkForm: function(e) { checkForm: function(e) {
@ -8118,12 +8122,12 @@
} }
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, i, key, last, n, reload, verify, w, x; var dx, i, img, key, last, n, reload, verify, w, x;
if (!(this.images && doc.contains(this.images[0]))) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
n = this.images.length; n = this.images.length;
w = Math.round(Math.sqrt(n)); w = this.width;
last = n + w - 1; last = n + w - 1;
reload = $('#recaptcha-reload-button, .fbc-button-reload'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
@ -8137,8 +8141,8 @@
} else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) {
this.images[i % 9].click(); this.images[i % 9].click();
verify.focus(); verify.focus();
} else if (n === 16 && (i = this.imageKeys16.indexOf(key)) >= 0) { } else if (n !== 9 && (i = this.imageKeys16.indexOf(key)) >= 0 && (img = this.images[(Math.floor(i / 4)) * w + (i % 4)])) {
this.images[i].click(); img.click();
verify.focus(); verify.focus();
} else if (dx = { } else if (dx = {
'Up': n, 'Up': n,

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.24.2 // @version 1.11.25.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -436,7 +436,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.24.2', VERSION: '1.11.25.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -8028,6 +8028,7 @@
return d.body.classList.toggle('focus', d.hasFocus()); return d.body.classList.toggle('focus', d.hasFocus());
}); });
this.images = $$('.fbc-payload-imageselect > input'); this.images = $$('.fbc-payload-imageselect > input');
this.width = 3;
if (this.images.length !== 9) { if (this.images.length !== 9) {
return; return;
} }
@ -8039,6 +8040,7 @@
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td'); this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td');
this.width = $$('.rc-imageselect-target tr:first-of-type td').length || Math.round(Math.sqrt(this.images.length));
ref = this.images; ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
img = ref[k]; img = ref[k];
@ -8046,8 +8048,7 @@
} }
if (this.images.length === 9) { if (this.images.length === 9) {
this.addTooltips(this.images); this.addTooltips(this.images);
} } else {
if (this.images.length === 16) {
this.addTooltips16(this.images); this.addTooltips16(this.images);
} }
return this.complaintLinks(); return this.complaintLinks();
@ -8097,10 +8098,13 @@
} }
}, },
addTooltips16: function(nodes) { addTooltips16: function(nodes) {
var i, k, len1, node; var i, k, key, len1, node, ref;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) { ref = this.imageKeys16;
node = nodes[i]; for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
node.title = "" + (this.imageKeys16[i][0].toUpperCase()) + this.imageKeys16[i].slice(1); key = ref[i];
if ((node = nodes[(Math.floor(i / 4)) * this.width + (i % 4)])) {
node.title = "" + (key[0].toUpperCase()) + key.slice(1);
}
} }
}, },
checkForm: function(e) { checkForm: function(e) {
@ -8118,12 +8122,12 @@
} }
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, i, key, last, n, reload, verify, w, x; var dx, i, img, key, last, n, reload, verify, w, x;
if (!(this.images && doc.contains(this.images[0]))) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
n = this.images.length; n = this.images.length;
w = Math.round(Math.sqrt(n)); w = this.width;
last = n + w - 1; last = n + w - 1;
reload = $('#recaptcha-reload-button, .fbc-button-reload'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
@ -8137,8 +8141,8 @@
} else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) {
this.images[i % 9].click(); this.images[i % 9].click();
verify.focus(); verify.focus();
} else if (n === 16 && (i = this.imageKeys16.indexOf(key)) >= 0) { } else if (n !== 9 && (i = this.imageKeys16.indexOf(key)) >= 0 && (img = this.images[(Math.floor(i / 4)) * w + (i % 4)])) {
this.images[i].click(); img.click();
verify.focus(); verify.focus();
} else if (dx = { } else if (dx = {
'Up': n, 'Up': n,

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.11.24.2 // @version 1.11.25.0
// @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.24.2 // @version 1.11.25.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -436,7 +436,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.24.2', VERSION: '1.11.25.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -8028,6 +8028,7 @@
return d.body.classList.toggle('focus', d.hasFocus()); return d.body.classList.toggle('focus', d.hasFocus());
}); });
this.images = $$('.fbc-payload-imageselect > input'); this.images = $$('.fbc-payload-imageselect > input');
this.width = 3;
if (this.images.length !== 9) { if (this.images.length !== 9) {
return; return;
} }
@ -8039,6 +8040,7 @@
fixImages: function() { fixImages: function() {
var img, k, len1, ref; var img, k, len1, ref;
this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td'); this.images = $$('.rc-imageselect-target > div, .rc-imageselect-target td');
this.width = $$('.rc-imageselect-target tr:first-of-type td').length || Math.round(Math.sqrt(this.images.length));
ref = this.images; ref = this.images;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
img = ref[k]; img = ref[k];
@ -8046,8 +8048,7 @@
} }
if (this.images.length === 9) { if (this.images.length === 9) {
this.addTooltips(this.images); this.addTooltips(this.images);
} } else {
if (this.images.length === 16) {
this.addTooltips16(this.images); this.addTooltips16(this.images);
} }
return this.complaintLinks(); return this.complaintLinks();
@ -8097,10 +8098,13 @@
} }
}, },
addTooltips16: function(nodes) { addTooltips16: function(nodes) {
var i, k, len1, node; var i, k, key, len1, node, ref;
for (i = k = 0, len1 = nodes.length; k < len1; i = ++k) { ref = this.imageKeys16;
node = nodes[i]; for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
node.title = "" + (this.imageKeys16[i][0].toUpperCase()) + this.imageKeys16[i].slice(1); key = ref[i];
if ((node = nodes[(Math.floor(i / 4)) * this.width + (i % 4)])) {
node.title = "" + (key[0].toUpperCase()) + key.slice(1);
}
} }
}, },
checkForm: function(e) { checkForm: function(e) {
@ -8118,12 +8122,12 @@
} }
}, },
keybinds: function(e) { keybinds: function(e) {
var dx, i, key, last, n, reload, verify, w, x; var dx, i, img, key, last, n, reload, verify, w, x;
if (!(this.images && doc.contains(this.images[0]))) { if (!(this.images && doc.contains(this.images[0]))) {
return; return;
} }
n = this.images.length; n = this.images.length;
w = Math.round(Math.sqrt(n)); w = this.width;
last = n + w - 1; last = n + w - 1;
reload = $('#recaptcha-reload-button, .fbc-button-reload'); reload = $('#recaptcha-reload-button, .fbc-button-reload');
verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input');
@ -8137,8 +8141,8 @@
} else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) {
this.images[i % 9].click(); this.images[i % 9].click();
verify.focus(); verify.focus();
} else if (n === 16 && (i = this.imageKeys16.indexOf(key)) >= 0) { } else if (n !== 9 && (i = this.imageKeys16.indexOf(key)) >= 0 && (img = this.images[(Math.floor(i / 4)) * w + (i % 4)])) {
this.images[i].click(); img.click();
verify.focus(); verify.focus();
} else if (dx = { } else if (dx = {
'Up': n, 'Up': n,

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://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.24.2' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.25.0' />
</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://www.4chan-x.net/builds/4chan-X.crx' version='1.11.24.2' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.11.25.0' />
</app> </app>
</gupdate> </gupdate>

View File

@ -71,6 +71,7 @@ Captcha.fixes =
$.on window, 'focus blur', -> d.body.classList.toggle 'focus', d.hasFocus() $.on window, 'focus blur', -> d.body.classList.toggle 'focus', d.hasFocus()
@images = $$ '.fbc-payload-imageselect > input' @images = $$ '.fbc-payload-imageselect > input'
@width = 3
return unless @images.length is 9 return unless @images.length is 9
$.addStyle @cssNoscript $.addStyle @cssNoscript
@ -80,10 +81,13 @@ Captcha.fixes =
fixImages: -> fixImages: ->
@images = $$ '.rc-imageselect-target > div, .rc-imageselect-target td' @images = $$ '.rc-imageselect-target > div, .rc-imageselect-target td'
@width = $$('.rc-imageselect-target tr:first-of-type td').length or Math.round(Math.sqrt @images.length)
for img in @images for img in @images
img.tabIndex = 0 img.tabIndex = 0
@addTooltips @images if @images.length is 9 if @images.length is 9
@addTooltips16 @images if @images.length is 16 @addTooltips @images
else
@addTooltips16 @images
@complaintLinks() @complaintLinks()
complaintLinks: -> complaintLinks: ->
@ -114,8 +118,9 @@ Captcha.fixes =
return return
addTooltips16: (nodes) -> addTooltips16: (nodes) ->
for node, i in nodes for key, i in @imageKeys16
node.title = "#{@imageKeys16[i][0].toUpperCase()}#{@imageKeys16[i][1..]}" if (node = nodes[(i // 4)*@width + (i % 4)])
node.title = "#{key[0].toUpperCase()}#{key[1..]}"
return return
checkForm: (e) -> checkForm: (e) ->
@ -126,7 +131,7 @@ Captcha.fixes =
keybinds: (e) -> keybinds: (e) ->
return unless @images and doc.contains(@images[0]) return unless @images and doc.contains(@images[0])
n = @images.length n = @images.length
w = Math.round Math.sqrt n w = @width
last = n + w - 1 last = n + w - 1
reload = $ '#recaptcha-reload-button, .fbc-button-reload' reload = $ '#recaptcha-reload-button, .fbc-button-reload'
@ -141,8 +146,8 @@ Captcha.fixes =
else if n is 9 and (i = @imageKeys.indexOf key) >= 0 else if n is 9 and (i = @imageKeys.indexOf key) >= 0
@images[i % 9].click() @images[i % 9].click()
verify.focus() verify.focus()
else if n is 16 and (i = @imageKeys16.indexOf key) >= 0 else if n isnt 9 and (i = @imageKeys16.indexOf key) >= 0 and (img = @images[(i // 4)*w + (i % 4)])
@images[i].click() img.click()
verify.focus() verify.focus()
else if dx = {'Up': n, 'Down': w, 'Left': last, 'Right': 1}[key] else if dx = {'Up': n, 'Down': w, 'Left': last, 'Right': 1}[key]
x = (x + dx) % (n + w) x = (x + dx) % (n + w)

View File

@ -1,4 +1,4 @@
{ {
"version": "1.11.24.2", "version": "1.11.25.0",
"date": "2016-02-09T05:14:16.973Z" "date": "2016-02-11T09:16:54.091Z"
} }