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).
### 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.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==
// @name 4chan X beta
// @version 1.11.24.2
// @version 1.11.25.0
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

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

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<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>
</gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<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>
</gupdate>

View File

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

View File

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