diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d3691f1..f1ca61ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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")] diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index ec21d77ef..7b7810ca7 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 5b7000538..585192180 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.24.2 +// @version 1.11.25.0 // @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 08dcbc91b..a05549484 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.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, diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index b1657f8e7..00d4c9dce 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 79290aa37..46344f5b1 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.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, diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 37689716b..6c66acddc 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 051fe45e8..e4faeaa9a 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -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 diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index ecdede429..c901419d3 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.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, diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 666a106df..8d37eaae0 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 3c64a4a5d..6a028867c 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 f519edddf..c18510fe3 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/src/Posting/Captcha.fixes.coffee b/src/Posting/Captcha.fixes.coffee index 9d1d59dd3..92efe6c8f 100644 --- a/src/Posting/Captcha.fixes.coffee +++ b/src/Posting/Captcha.fixes.coffee @@ -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) diff --git a/version.json b/version.json index c3e4ee467..ce7fe0699 100644 --- a/version.json +++ b/version.json @@ -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" }