diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b0f790e2..1bfce7058 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ The links to individual versions below are to copies of the script with the upda ### v1.11.3 +**v1.11.3.1** *(2015-07-04)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.1/builds/4chan-X-noupdate.crx "Chromium version")] +- Make posting from URL more efficient, and make it work in Tampermonkey. + **v1.11.3.0** *(2015-07-04)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.0/builds/4chan-X-noupdate.crx "Chromium version")] - Based on v1.11.2.4. - Improved Tampermonkey and WebKit support. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 51698749e..59c51dbf5 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 9a3a9bf28..c6bbb4230 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.3.0 +// @version 1.11.3.1 // @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 e03357060..7227526c5 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.3.0 +// @version 1.11.3.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.0', + VERSION: '1.11.3.1', NAMESPACE: '4chan X.', boards: {} }; @@ -4920,22 +4920,27 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { + var options, workaround; if (headers == null) { headers = {}; } - return GM_xmlhttpRequest({ + workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + options = { method: "GET", url: url, headers: headers, - overrideMimeType: "text/plain; charset=x-user-defined", onload: function(xhr) { var contentDisposition, contentType, data, i, r, ref, ref1; - r = xhr.responseText; - data = new Uint8Array(r.length); - i = 0; - while (i < r.length) { - data[i] = r.charCodeAt(i); - i++; + if (workaround) { + r = xhr.responseText; + data = new Uint8Array(r.length); + i = 0; + while (i < r.length) { + data[i] = r.charCodeAt(i); + i++; + } + } else { + data = new Uint8Array(xhr.response); } contentType = (ref = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref[1] : void 0; contentDisposition = (ref1 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref1[1] : void 0; @@ -4947,7 +4952,13 @@ onabort: function() { return cb(null); } - }); + }; + if (workaround) { + options.overrideMimeType = 'text/plain; charset=x-user-defined'; + } else { + options.responseType = 'arraybuffer'; + } + return GM_xmlhttpRequest(options); }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index d655be62d..06ca7e2ac 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 3e1f53aac..73be69837 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.3.0 +// @version 1.11.3.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -411,7 +411,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.0', + VERSION: '1.11.3.1', NAMESPACE: '4chan X.', boards: {} }; @@ -4919,22 +4919,27 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { + var options, workaround; if (headers == null) { headers = {}; } - return GM_xmlhttpRequest({ + workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + options = { method: "GET", url: url, headers: headers, - overrideMimeType: "text/plain; charset=x-user-defined", onload: function(xhr) { var contentDisposition, contentType, data, i, r, ref, ref1; - r = xhr.responseText; - data = new Uint8Array(r.length); - i = 0; - while (i < r.length) { - data[i] = r.charCodeAt(i); - i++; + if (workaround) { + r = xhr.responseText; + data = new Uint8Array(r.length); + i = 0; + while (i < r.length) { + data[i] = r.charCodeAt(i); + i++; + } + } else { + data = new Uint8Array(xhr.response); } contentType = (ref = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref[1] : void 0; contentDisposition = (ref1 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref1[1] : void 0; @@ -4946,7 +4951,13 @@ onabort: function() { return cb(null); } - }); + }; + if (workaround) { + options.overrideMimeType = 'text/plain; charset=x-user-defined'; + } else { + options.responseType = 'arraybuffer'; + } + return GM_xmlhttpRequest(options); }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 7e2a14a04..d9677d740 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 b73cc4a13..2b7fb9ad7 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.3.0 +// @version 1.11.3.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index e82a0b092..a76948544 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.3.0 +// @version 1.11.3.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.0', + VERSION: '1.11.3.1', NAMESPACE: '4chan X.', boards: {} }; @@ -4920,22 +4920,27 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { + var options, workaround; if (headers == null) { headers = {}; } - return GM_xmlhttpRequest({ + workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + options = { method: "GET", url: url, headers: headers, - overrideMimeType: "text/plain; charset=x-user-defined", onload: function(xhr) { var contentDisposition, contentType, data, i, r, ref, ref1; - r = xhr.responseText; - data = new Uint8Array(r.length); - i = 0; - while (i < r.length) { - data[i] = r.charCodeAt(i); - i++; + if (workaround) { + r = xhr.responseText; + data = new Uint8Array(r.length); + i = 0; + while (i < r.length) { + data[i] = r.charCodeAt(i); + i++; + } + } else { + data = new Uint8Array(xhr.response); } contentType = (ref = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref[1] : void 0; contentDisposition = (ref1 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref1[1] : void 0; @@ -4947,7 +4952,13 @@ onabort: function() { return cb(null); } - }); + }; + if (workaround) { + options.overrideMimeType = 'text/plain; charset=x-user-defined'; + } else { + options.responseType = 'arraybuffer'; + } + return GM_xmlhttpRequest(options); }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index abcd17c84..898a986ad 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 4d7ab88b5..62ba39c81 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 a91c5084a..96ea75cb2 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index fb73b080a..242ccb3ad 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.3.0", - "date": "2015-07-04T20:11:44.204Z", + "version": "1.11.3.1", + "date": "2015-07-04T21:55:48.953Z", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",