diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bd4065dc..bd43b102a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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.9 + +**v1.11.9.0** *(2015-08-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.9.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.9.0/builds/4chan-X-noupdate.crx "Chromium version")] +- Based on v1.11.8.8. +- Add `Randomize Filename` option: Replaces filenames with a random timestamp from the past year. +- Fix bugs with cached captchas when you change captcha settings. + ### v1.11.8 **v1.11.8.8** *(2015-08-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.8.8/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.8.8/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index b84025ac5..a6728ac5a 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 69800a697..9ff1be434 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.8.8 +// @version 1.11.9.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 cababdf72..d419f1761 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.8.8 +// @version 1.11.9.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -238,6 +238,7 @@ 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.', 1], 'Remember QR Size': [false, 'Remember the size of the Quick reply.', 1], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.', 1], + 'Randomize Filename': [false, 'Set the filename to a random timestamp within the past year. Disabled on /f/.', 1], 'Show New Thread Option in Threads': [false, 'Show the option to post a new / different thread from inside a thread.', 1], 'Show Name and Subject': [false, 'Show the classic name, email, and subject fields in the QR, even when 4chan doesn\'t use them all.', 1], 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], @@ -411,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.8.8', + VERSION: '1.11.9.0', NAMESPACE: '4chan X.', boards: {} }; @@ -6793,6 +6794,7 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + validExtension: /\.(jpe?g|png|gif|pdf|swf|webm)$/i, typeFromExtension: { 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', @@ -7252,7 +7254,7 @@ blob = new Blob([arr], { type: m[1] }); - blob.name = "image." + m[2]; + blob.name = "file." + m[2]; QR.handleFiles([blob]); } else if (/^https?:\/\//.test(src)) { QR.handleUrl(src); @@ -7597,7 +7599,7 @@ extra.form.append('recaptcha_challenge_field', response.challenge); extra.form.append('recaptcha_response_field', response.response); } else { - extra.form.append('g-recaptcha-response', response); + extra.form.append('g-recaptcha-response', response.response); } } QR.req = $.ajax("https://sys.4chan.org/" + g.BOARD + "/post", options, extra); @@ -8080,10 +8082,7 @@ if (captcha = this.captchas.shift()) { this.count(); $.set('captchas', this.captchas); - return { - challenge: captcha.response, - response: 'manual_challenge' - }; + return captcha; } else if (/\S/.test(this.nodes.input.value)) { return (function(_this) { return function(cb) { @@ -8105,13 +8104,16 @@ } }, save: function(token) { + var captcha; delete this.occupied; this.nodes.input.value = ''; + captcha = { + challenge: token, + response: 'manual_challenge', + timeout: this.timeout + }; if (this.submitCB) { - this.submitCB({ - challenge: token, - response: 'manual_challenge' - }); + this.submitCB(captcha); delete this.submitCB; if (this.needed()) { return this.reload(); @@ -8120,10 +8122,7 @@ } } else { $.forceSync('captchas'); - this.captchas.push({ - response: token, - timeout: this.timeout - }); + this.captchas.push(captcha); this.count(); $.set('captchas', this.captchas); return this.reload(); @@ -8475,24 +8474,26 @@ return QR.captcha.count(); }, getOne: function() { - var captcha, challenge, response; + var captcha, challenge, response, timeout; this.clear(); if (captcha = this.captchas.shift()) { - challenge = captcha.challenge, response = captcha.response; this.count(); $.set('captchas', this.captchas); + return captcha; } else { challenge = this.nodes.img.alt; + timeout = this.timeout; if (/\S/.test(response = this.nodes.input.value)) { this.destroy(); + return { + challenge: challenge, + response: response, + timeout: timeout + }; } else { return null; } } - return { - challenge: challenge, - response: response - }; }, save: function() { var response; @@ -8816,7 +8817,7 @@ if (captcha = this.captchas.shift()) { $.set('captchas', this.captchas); this.count(); - return captcha.response; + return captcha; } else { return null; } @@ -9474,9 +9475,16 @@ }; _Class.prototype.setFile = function(file1) { - var ref; + var ext, ref; this.file = file1; - this.filename = this.file.name; + if (Conf['Randomize Filename'] && g.BOARD.ID !== 'f') { + this.filename = "" + (Date.now() - Math.floor(Math.random() * 365 * $.DAY)); + if (ext = this.file.name.match(QR.validExtension)) { + this.filename += ext[0]; + } + } else { + this.filename = this.file.name; + } this.filesize = $.bytesToString(this.file.size); this.checkSize(); if (QR.spoiler) { @@ -9631,7 +9639,7 @@ _Class.prototype.saveFilename = function() { this.file.newName = (this.filename || '').replace(/[\/\\]/g, '-'); - if (!/\.(jpe?g|png|gif|pdf|swf|webm)$/i.test(this.filename)) { + if (!QR.validExtension.test(this.filename)) { return this.file.newName += '.jpg'; } }; diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 22ebff955..962c651a8 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 809efad8f..ec627cb54 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.8.8 +// @version 1.11.9.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -237,6 +237,7 @@ 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.', 1], 'Remember QR Size': [false, 'Remember the size of the Quick reply.', 1], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.', 1], + 'Randomize Filename': [false, 'Set the filename to a random timestamp within the past year. Disabled on /f/.', 1], 'Show New Thread Option in Threads': [false, 'Show the option to post a new / different thread from inside a thread.', 1], 'Show Name and Subject': [false, 'Show the classic name, email, and subject fields in the QR, even when 4chan doesn\'t use them all.', 1], 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], @@ -410,7 +411,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.8.8', + VERSION: '1.11.9.0', NAMESPACE: '4chan X.', boards: {} }; @@ -6792,6 +6793,7 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + validExtension: /\.(jpe?g|png|gif|pdf|swf|webm)$/i, typeFromExtension: { 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', @@ -7251,7 +7253,7 @@ blob = new Blob([arr], { type: m[1] }); - blob.name = "image." + m[2]; + blob.name = "file." + m[2]; QR.handleFiles([blob]); } else if (/^https?:\/\//.test(src)) { QR.handleUrl(src); @@ -7596,7 +7598,7 @@ extra.form.append('recaptcha_challenge_field', response.challenge); extra.form.append('recaptcha_response_field', response.response); } else { - extra.form.append('g-recaptcha-response', response); + extra.form.append('g-recaptcha-response', response.response); } } QR.req = $.ajax("https://sys.4chan.org/" + g.BOARD + "/post", options, extra); @@ -8079,10 +8081,7 @@ if (captcha = this.captchas.shift()) { this.count(); $.set('captchas', this.captchas); - return { - challenge: captcha.response, - response: 'manual_challenge' - }; + return captcha; } else if (/\S/.test(this.nodes.input.value)) { return (function(_this) { return function(cb) { @@ -8104,13 +8103,16 @@ } }, save: function(token) { + var captcha; delete this.occupied; this.nodes.input.value = ''; + captcha = { + challenge: token, + response: 'manual_challenge', + timeout: this.timeout + }; if (this.submitCB) { - this.submitCB({ - challenge: token, - response: 'manual_challenge' - }); + this.submitCB(captcha); delete this.submitCB; if (this.needed()) { return this.reload(); @@ -8119,10 +8121,7 @@ } } else { $.forceSync('captchas'); - this.captchas.push({ - response: token, - timeout: this.timeout - }); + this.captchas.push(captcha); this.count(); $.set('captchas', this.captchas); return this.reload(); @@ -8474,24 +8473,26 @@ return QR.captcha.count(); }, getOne: function() { - var captcha, challenge, response; + var captcha, challenge, response, timeout; this.clear(); if (captcha = this.captchas.shift()) { - challenge = captcha.challenge, response = captcha.response; this.count(); $.set('captchas', this.captchas); + return captcha; } else { challenge = this.nodes.img.alt; + timeout = this.timeout; if (/\S/.test(response = this.nodes.input.value)) { this.destroy(); + return { + challenge: challenge, + response: response, + timeout: timeout + }; } else { return null; } } - return { - challenge: challenge, - response: response - }; }, save: function() { var response; @@ -8815,7 +8816,7 @@ if (captcha = this.captchas.shift()) { $.set('captchas', this.captchas); this.count(); - return captcha.response; + return captcha; } else { return null; } @@ -9473,9 +9474,16 @@ }; _Class.prototype.setFile = function(file1) { - var ref; + var ext, ref; this.file = file1; - this.filename = this.file.name; + if (Conf['Randomize Filename'] && g.BOARD.ID !== 'f') { + this.filename = "" + (Date.now() - Math.floor(Math.random() * 365 * $.DAY)); + if (ext = this.file.name.match(QR.validExtension)) { + this.filename += ext[0]; + } + } else { + this.filename = this.file.name; + } this.filesize = $.bytesToString(this.file.size); this.checkSize(); if (QR.spoiler) { @@ -9630,7 +9638,7 @@ _Class.prototype.saveFilename = function() { this.file.newName = (this.filename || '').replace(/[\/\\]/g, '-'); - if (!/\.(jpe?g|png|gif|pdf|swf|webm)$/i.test(this.filename)) { + if (!QR.validExtension.test(this.filename)) { return this.file.newName += '.jpg'; } }; diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 52a530ebc..838a67d51 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 5fbb97275..930be48a2 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.8.8 +// @version 1.11.9.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 414e66f8f..59f3fa4d4 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.8.8 +// @version 1.11.9.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -238,6 +238,7 @@ 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.', 1], 'Remember QR Size': [false, 'Remember the size of the Quick reply.', 1], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.', 1], + 'Randomize Filename': [false, 'Set the filename to a random timestamp within the past year. Disabled on /f/.', 1], 'Show New Thread Option in Threads': [false, 'Show the option to post a new / different thread from inside a thread.', 1], 'Show Name and Subject': [false, 'Show the classic name, email, and subject fields in the QR, even when 4chan doesn\'t use them all.', 1], 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], @@ -411,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.8.8', + VERSION: '1.11.9.0', NAMESPACE: '4chan X.', boards: {} }; @@ -6793,6 +6794,7 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + validExtension: /\.(jpe?g|png|gif|pdf|swf|webm)$/i, typeFromExtension: { 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', @@ -7252,7 +7254,7 @@ blob = new Blob([arr], { type: m[1] }); - blob.name = "image." + m[2]; + blob.name = "file." + m[2]; QR.handleFiles([blob]); } else if (/^https?:\/\//.test(src)) { QR.handleUrl(src); @@ -7597,7 +7599,7 @@ extra.form.append('recaptcha_challenge_field', response.challenge); extra.form.append('recaptcha_response_field', response.response); } else { - extra.form.append('g-recaptcha-response', response); + extra.form.append('g-recaptcha-response', response.response); } } QR.req = $.ajax("https://sys.4chan.org/" + g.BOARD + "/post", options, extra); @@ -8080,10 +8082,7 @@ if (captcha = this.captchas.shift()) { this.count(); $.set('captchas', this.captchas); - return { - challenge: captcha.response, - response: 'manual_challenge' - }; + return captcha; } else if (/\S/.test(this.nodes.input.value)) { return (function(_this) { return function(cb) { @@ -8105,13 +8104,16 @@ } }, save: function(token) { + var captcha; delete this.occupied; this.nodes.input.value = ''; + captcha = { + challenge: token, + response: 'manual_challenge', + timeout: this.timeout + }; if (this.submitCB) { - this.submitCB({ - challenge: token, - response: 'manual_challenge' - }); + this.submitCB(captcha); delete this.submitCB; if (this.needed()) { return this.reload(); @@ -8120,10 +8122,7 @@ } } else { $.forceSync('captchas'); - this.captchas.push({ - response: token, - timeout: this.timeout - }); + this.captchas.push(captcha); this.count(); $.set('captchas', this.captchas); return this.reload(); @@ -8475,24 +8474,26 @@ return QR.captcha.count(); }, getOne: function() { - var captcha, challenge, response; + var captcha, challenge, response, timeout; this.clear(); if (captcha = this.captchas.shift()) { - challenge = captcha.challenge, response = captcha.response; this.count(); $.set('captchas', this.captchas); + return captcha; } else { challenge = this.nodes.img.alt; + timeout = this.timeout; if (/\S/.test(response = this.nodes.input.value)) { this.destroy(); + return { + challenge: challenge, + response: response, + timeout: timeout + }; } else { return null; } } - return { - challenge: challenge, - response: response - }; }, save: function() { var response; @@ -8816,7 +8817,7 @@ if (captcha = this.captchas.shift()) { $.set('captchas', this.captchas); this.count(); - return captcha.response; + return captcha; } else { return null; } @@ -9474,9 +9475,16 @@ }; _Class.prototype.setFile = function(file1) { - var ref; + var ext, ref; this.file = file1; - this.filename = this.file.name; + if (Conf['Randomize Filename'] && g.BOARD.ID !== 'f') { + this.filename = "" + (Date.now() - Math.floor(Math.random() * 365 * $.DAY)); + if (ext = this.file.name.match(QR.validExtension)) { + this.filename += ext[0]; + } + } else { + this.filename = this.file.name; + } this.filesize = $.bytesToString(this.file.size); this.checkSize(); if (QR.spoiler) { @@ -9631,7 +9639,7 @@ _Class.prototype.saveFilename = function() { this.file.newName = (this.filename || '').replace(/[\/\\]/g, '-'); - if (!/\.(jpe?g|png|gif|pdf|swf|webm)$/i.test(this.filename)) { + if (!QR.validExtension.test(this.filename)) { return this.file.newName += '.jpg'; } }; diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 82d7ba708..7f679b9be 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 ffec964d3..d2dc0e0a5 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 3480040e8..fa24e1a66 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index 9318ec08a..ede8497b1 100644 --- 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.8.8", - "date": "2015-08-15T17:24:37.293Z", + "version": "1.11.9.0", + "date": "2015-08-15T18:45:44.807Z", "page": "https://www.4chan-x.net/", "downloads": "https://www.4chan-x.net/builds/", "oldVersions": "https://raw.githubusercontent.com/ccd0/4chan-x/",