diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bfce7058..df783adb2 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.2** *(2015-07-05)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.3.2/builds/4chan-X-noupdate.crx "Chromium version")] +- Get posting from URLs, WebM titles, and Vocaroo/Clyp embedding working in Safari. + **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. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 59c51dbf5..f85615941 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 c6bbb4230..332a4ba6b 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.1 +// @version 1.11.3.2 // @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 7227526c5..e01339db7 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.1 +// @version 1.11.3.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.1', + VERSION: '1.11.3.2', NAMESPACE: '4chan X.', boards: {} }; @@ -4920,17 +4920,18 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { - var options, workaround; + var options, ref, workaround; if (headers == null) { headers = {}; } - workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround = $.engine === 'gecko' && (typeof GM_info !== "undefined" && GM_info !== null) && /^[0-2]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround || (workaround = (typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.script) != null ? ref.includeJSB : void 0 : void 0) != null); options = { method: "GET", url: url, headers: headers, onload: function(xhr) { - var contentDisposition, contentType, data, i, r, ref, ref1; + var contentDisposition, contentType, data, i, r, ref1, ref2; if (workaround) { r = xhr.responseText; data = new Uint8Array(r.length); @@ -4942,8 +4943,13 @@ } 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; + if (typeof xhr.responseHeaders === 'object') { + contentType = xhr.responseHeaders['Content-Type']; + contentDisposition = xhr.responseHeaders['Content-Disposition']; + } else { + contentType = (ref1 = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref1[1] : void 0; + contentDisposition = (ref2 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref2[1] : void 0; + } return cb(data, contentType, contentDisposition); }, onerror: function() { @@ -4954,7 +4960,7 @@ } }; if (workaround) { - options.overrideMimeType = 'text/plain; charset=x-user-defined'; + options.overrideMimeType = options.mimeType = 'text/plain; charset=x-user-defined'; } else { options.responseType = 'arraybuffer'; } @@ -4962,7 +4968,7 @@ }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { - var blob, match, mime, name, ref, ref1, ref2; + var blob, match, mime, name, ref, ref1, ref2, ref3; if (data == null) { return cb(null); } @@ -4972,6 +4978,9 @@ if (match) { name = match.replace(/\\"/g, '"'); } + if ((typeof GM_info !== "undefined" && GM_info !== null ? (ref3 = GM_info.script) != null ? ref3.includeJSB : void 0 : void 0) != null) { + mime = QR.typeFromExtension[name.match(/[^.]*$/)[0].toLowerCase()] || 'application/octet-stream'; + } blob = new Blob([data], { type: mime }); @@ -6764,6 +6773,15 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + typeFromExtension: { + 'jpg': 'image/jpeg', + 'jpeg': 'image/jpeg', + 'png': 'image/png', + 'gif': 'image/gif', + 'pdf': 'application/pdf', + 'swf': 'application/vnd.adobe.flash.movie', + 'webm': 'video/webm' + }, init: function() { var noscript, sc, version; if (!Conf['Quick Reply']) { @@ -9466,6 +9484,9 @@ var el, event, isVideo, onerror, onload; isVideo = /^video\//.test(this.file.type); el = $.el(isVideo ? 'video' : 'img'); + if (isVideo && !el.canPlayType(this.file.type)) { + return; + } event = isVideo ? 'loadeddata' : 'load'; onload = (function(_this) { return function() { @@ -11817,11 +11838,14 @@ regExp: /^\w+:\/\/(?:www\.)?vocaroo\.com\/i\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_" + type; + return el; } }, { key: 'Vimeo', @@ -11961,11 +11985,14 @@ regExp: /^\w+:\/\/(?:www\.)?clyp\.it\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://clyp.it/" + a.dataset.uid + ".ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://clyp.it/" + a.dataset.uid + "." + type; + return el; } }, { key: 'Loopvid-dummy', diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 06ca7e2ac..93d09a100 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 73be69837..af2da1e9b 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.1 +// @version 1.11.3.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -411,7 +411,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.1', + VERSION: '1.11.3.2', NAMESPACE: '4chan X.', boards: {} }; @@ -4919,17 +4919,18 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { - var options, workaround; + var options, ref, workaround; if (headers == null) { headers = {}; } - workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround = $.engine === 'gecko' && (typeof GM_info !== "undefined" && GM_info !== null) && /^[0-2]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround || (workaround = (typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.script) != null ? ref.includeJSB : void 0 : void 0) != null); options = { method: "GET", url: url, headers: headers, onload: function(xhr) { - var contentDisposition, contentType, data, i, r, ref, ref1; + var contentDisposition, contentType, data, i, r, ref1, ref2; if (workaround) { r = xhr.responseText; data = new Uint8Array(r.length); @@ -4941,8 +4942,13 @@ } 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; + if (typeof xhr.responseHeaders === 'object') { + contentType = xhr.responseHeaders['Content-Type']; + contentDisposition = xhr.responseHeaders['Content-Disposition']; + } else { + contentType = (ref1 = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref1[1] : void 0; + contentDisposition = (ref2 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref2[1] : void 0; + } return cb(data, contentType, contentDisposition); }, onerror: function() { @@ -4953,7 +4959,7 @@ } }; if (workaround) { - options.overrideMimeType = 'text/plain; charset=x-user-defined'; + options.overrideMimeType = options.mimeType = 'text/plain; charset=x-user-defined'; } else { options.responseType = 'arraybuffer'; } @@ -4961,7 +4967,7 @@ }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { - var blob, match, mime, name, ref, ref1, ref2; + var blob, match, mime, name, ref, ref1, ref2, ref3; if (data == null) { return cb(null); } @@ -4971,6 +4977,9 @@ if (match) { name = match.replace(/\\"/g, '"'); } + if ((typeof GM_info !== "undefined" && GM_info !== null ? (ref3 = GM_info.script) != null ? ref3.includeJSB : void 0 : void 0) != null) { + mime = QR.typeFromExtension[name.match(/[^.]*$/)[0].toLowerCase()] || 'application/octet-stream'; + } blob = new Blob([data], { type: mime }); @@ -6763,6 +6772,15 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + typeFromExtension: { + 'jpg': 'image/jpeg', + 'jpeg': 'image/jpeg', + 'png': 'image/png', + 'gif': 'image/gif', + 'pdf': 'application/pdf', + 'swf': 'application/vnd.adobe.flash.movie', + 'webm': 'video/webm' + }, init: function() { var noscript, sc, version; if (!Conf['Quick Reply']) { @@ -9465,6 +9483,9 @@ var el, event, isVideo, onerror, onload; isVideo = /^video\//.test(this.file.type); el = $.el(isVideo ? 'video' : 'img'); + if (isVideo && !el.canPlayType(this.file.type)) { + return; + } event = isVideo ? 'loadeddata' : 'load'; onload = (function(_this) { return function() { @@ -11816,11 +11837,14 @@ regExp: /^\w+:\/\/(?:www\.)?vocaroo\.com\/i\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_" + type; + return el; } }, { key: 'Vimeo', @@ -11960,11 +11984,14 @@ regExp: /^\w+:\/\/(?:www\.)?clyp\.it\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://clyp.it/" + a.dataset.uid + ".ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://clyp.it/" + a.dataset.uid + "." + type; + return el; } }, { key: 'Loopvid-dummy', diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index d9677d740..259598d30 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 2b7fb9ad7..b74722960 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.1 +// @version 1.11.3.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index a76948544..f82b408b6 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.1 +// @version 1.11.3.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.3.1', + VERSION: '1.11.3.2', NAMESPACE: '4chan X.', boards: {} }; @@ -4920,17 +4920,18 @@ CrossOrigin = (function() { return { binary: function(url, cb, headers) { - var options, workaround; + var options, ref, workaround; if (headers == null) { headers = {}; } - workaround = !GM_info.scriptHandler && /^[12]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround = $.engine === 'gecko' && (typeof GM_info !== "undefined" && GM_info !== null) && /^[0-2]\.|^3\.[01](?!\d)/.test(GM_info.version); + workaround || (workaround = (typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.script) != null ? ref.includeJSB : void 0 : void 0) != null); options = { method: "GET", url: url, headers: headers, onload: function(xhr) { - var contentDisposition, contentType, data, i, r, ref, ref1; + var contentDisposition, contentType, data, i, r, ref1, ref2; if (workaround) { r = xhr.responseText; data = new Uint8Array(r.length); @@ -4942,8 +4943,13 @@ } 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; + if (typeof xhr.responseHeaders === 'object') { + contentType = xhr.responseHeaders['Content-Type']; + contentDisposition = xhr.responseHeaders['Content-Disposition']; + } else { + contentType = (ref1 = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? ref1[1] : void 0; + contentDisposition = (ref2 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? ref2[1] : void 0; + } return cb(data, contentType, contentDisposition); }, onerror: function() { @@ -4954,7 +4960,7 @@ } }; if (workaround) { - options.overrideMimeType = 'text/plain; charset=x-user-defined'; + options.overrideMimeType = options.mimeType = 'text/plain; charset=x-user-defined'; } else { options.responseType = 'arraybuffer'; } @@ -4962,7 +4968,7 @@ }, file: function(url, cb) { return CrossOrigin.binary(url, function(data, contentType, contentDisposition) { - var blob, match, mime, name, ref, ref1, ref2; + var blob, match, mime, name, ref, ref1, ref2, ref3; if (data == null) { return cb(null); } @@ -4972,6 +4978,9 @@ if (match) { name = match.replace(/\\"/g, '"'); } + if ((typeof GM_info !== "undefined" && GM_info !== null ? (ref3 = GM_info.script) != null ? ref3.includeJSB : void 0 : void 0) != null) { + mime = QR.typeFromExtension[name.match(/[^.]*$/)[0].toLowerCase()] || 'application/octet-stream'; + } blob = new Blob([data], { type: mime }); @@ -6764,6 +6773,15 @@ QR = { mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'], + typeFromExtension: { + 'jpg': 'image/jpeg', + 'jpeg': 'image/jpeg', + 'png': 'image/png', + 'gif': 'image/gif', + 'pdf': 'application/pdf', + 'swf': 'application/vnd.adobe.flash.movie', + 'webm': 'video/webm' + }, init: function() { var noscript, sc, version; if (!Conf['Quick Reply']) { @@ -9466,6 +9484,9 @@ var el, event, isVideo, onerror, onload; isVideo = /^video\//.test(this.file.type); el = $.el(isVideo ? 'video' : 'img'); + if (isVideo && !el.canPlayType(this.file.type)) { + return; + } event = isVideo ? 'loadeddata' : 'load'; onload = (function(_this) { return function() { @@ -11817,11 +11838,14 @@ regExp: /^\w+:\/\/(?:www\.)?vocaroo\.com\/i\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://vocaroo.com/media_command.php?media=" + a.dataset.uid + "&command=download_" + type; + return el; } }, { key: 'Vimeo', @@ -11961,11 +11985,14 @@ regExp: /^\w+:\/\/(?:www\.)?clyp\.it\/(\w+)/, style: '', el: function(a) { - return $.el('audio', { + var el, type; + el = $.el('audio', { controls: true, - preload: 'auto', - src: "http://clyp.it/" + a.dataset.uid + ".ogg" + preload: 'auto' }); + type = el.canPlayType('audio/ogg') ? 'ogg' : 'mp3'; + el.src = "http://clyp.it/" + a.dataset.uid + "." + type; + return el; } }, { key: 'Loopvid-dummy', diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 898a986ad..05c6f2853 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 62ba39c81..23350448b 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 96ea75cb2..aa9714d8f 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index 242ccb3ad..9248012a6 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.1", - "date": "2015-07-04T21:55:48.953Z", + "version": "1.11.3.2", + "date": "2015-07-05T10:21:13.314Z", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",