diff --git a/CHANGELOG.md b/CHANGELOG.md index 4baff2bb4..ce26cfad9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### v1.3.9 +*2014-02-20* + +**Spittie** +- Fix uploading (>me in charge of not being an idiot) + ### v1.3.8 *2014-02-20* diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index ea636b596..45cd75bb2 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5339,6 +5339,7 @@ }; QR = { + mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''], init: function() { var sc; if (!Conf['Quick Reply']) { @@ -5841,9 +5842,6 @@ value = _ref[key]; nodes[key] = $(value, dialog); } - ({ - mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''] - }); nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { diff --git a/builds/crx.crx b/builds/crx.crx index 946989232..4de50266d 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/script.js b/builds/crx/script.js index 0ae089cbf..105fe191c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5341,6 +5341,7 @@ }; QR = { + mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''], init: function() { var sc; if (!Conf['Quick Reply']) { @@ -5845,9 +5846,6 @@ value = _ref[key]; nodes[key] = $(value, dialog); } - ({ - mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''] - }); nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { diff --git a/builds/xpi/4chanx.xpi b/builds/xpi/4chanx.xpi index e85615b10..b75c2fce2 100644 Binary files a/builds/xpi/4chanx.xpi and b/builds/xpi/4chanx.xpi differ diff --git a/builds/xpi/data/4chan-X.user.js b/builds/xpi/data/4chan-X.user.js index 5456ed885..45cd75bb2 100644 --- a/builds/xpi/data/4chan-X.user.js +++ b/builds/xpi/data/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.3.7 +// @version 1.3.8 // @minGMVer 1.13 // @minFFVer 26 // @namespace 4chan-X @@ -23,7 +23,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.3.7 - 2014-02-15 +* 4chan X - Version 1.3.8 - 2014-02-20 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -360,7 +360,7 @@ doc = d.documentElement; g = { - VERSION: '1.3.7', + VERSION: '1.3.8', NAMESPACE: '4chan X.', boards: {}, threads: {}, @@ -5339,6 +5339,7 @@ }; QR = { + mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''], init: function() { var sc; if (!Conf['Quick Reply']) { @@ -5663,8 +5664,26 @@ QR.handleFiles(files); return $.addClass(QR.nodes.el, 'dump'); }, - handleBlob: function(blob) { - var _ref; + handleBlob: function(urlBlob, header, url) { + var blob, end, endnl, endsc, mime, name, name_end, name_start, start, _ref; + name = url.substr(url.lastIndexOf('/') + 1, url.length); + start = header.indexOf("Content-Type: ") + 14; + endsc = header.substr(start, header.length).indexOf(";"); + endnl = header.substr(start, header.length).indexOf("\n") - 1; + end = endnl; + if (endsc !== -1 && endsc < endnl) { + end = endsc; + } + mime = header.substr(start, end); + blob = new Blob([urlBlob], { + type: mime + }); + blob.name = url.substr(url.lastIndexOf('/') + 1, url.length); + name_start = header.indexOf('name="') + 6; + if (name_start - 6 !== -1) { + name_end = header.substr(name_start, header.length).indexOf('"'); + blob.name = header.substr(name_start, name_end); + } if (blob.type === null) { return QR.error("Unsupported file type."); } @@ -5684,7 +5703,7 @@ url: url, overrideMimeType: "text/plain; charset=x-user-defined", onload: function(xhr) { - var data, end, header, i, mime, r, start, urlBlob; + var data, i, r; r = xhr.responseText; data = new Uint8Array(r.length); i = 0; @@ -5692,18 +5711,7 @@ data[i] = r.charCodeAt(i); i++; } - header = xhr.responseHeaders; - start = header.indexOf("Content-Type: ") + 14; - end = header.substr(start, header.length).indexOf("\n") - 1; - mime = header.substr(start, end); - if (mime === null) { - return; - } - urlBlob = new Blob([data], { - type: mime - }); - urlBlob.name = url.substr(url.lastIndexOf('/') + 1, url.length); - QR.handleBlob(urlBlob); + QR.handleBlob(data, xhr.responseHeaders, url); return; return { onerror: function(xhr) { @@ -5800,7 +5808,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var check, dialog, elm, event, flagSelector, i, items, key, mimeTypes, name, node, nodes, save, value, _ref; + var dialog, elm, event, flagSelector, i, items, key, name, node, nodes, save, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
") }; @@ -5834,16 +5842,6 @@ value = _ref[key]; nodes[key] = $(value, dialog); } - check = { - jpg: 'image/jpeg', - pdf: 'application/pdf', - swf: 'application/x-shockwave-flash' - }; - mimeTypes = $('ul.rules > li').textContent.trim().match(/: (.+)/)[1].toLowerCase().replace(/\w+/g, function(type) { - return check[type] || ("image/" + type); - }); - QR.mimeTypes = mimeTypes.split(', '); - QR.mimeTypes.push(''); nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { @@ -9910,16 +9908,38 @@ Redirect = { init: function() { - var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _len, _ref, _ref1; + var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _len, _len1, _ref, _ref1, _ref2; o = { thread: {}, post: {}, file: {} }; - archives = Redirect.archives; - _ref = Conf['selectedArchives']; - for (boardID in _ref) { - record = _ref[boardID]; + archives = {}; + _ref = Redirect.archives; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + _ref1 = _ref[_i], name = _ref1.name, boards = _ref1.boards, files = _ref1.files, data = _ref1.data; + archives[name] = { + boards: boards, + files: files, + data: data + }; + software = data.software; + for (_j = 0, _len1 = boards.length; _j < _len1; _j++) { + boardID = boards[_j]; + if (!(boardID in o.thread)) { + o.thread[boardID] = data; + } + if (!(boardID in o.post || software !== 'foolfuuka')) { + o.post[boardID] = data; + } + if (!(boardID in o.file || __indexOf.call(files, boardID) < 0)) { + o.file[boardID] = data; + } + } + } + _ref2 = Conf['selectedArchives']; + for (boardID in _ref2) { + record = _ref2[boardID]; for (type in record) { id = record[type]; if (!((archive = archives[id]))) { @@ -9932,22 +9952,6 @@ o[type][boardID] = archive.data; } } - for (name in archives) { - _ref1 = archives[name], data = _ref1.data, boards = _ref1.boards, files = _ref1.files; - software = data.software; - for (_i = 0, _len = boards.length; _i < _len; _i++) { - boardID = boards[_i]; - if (!(boardID in o.thread)) { - o.thread[boardID] = data; - } - if (!(boardID in o.post || software !== 'foolfuuka')) { - o.post[boardID] = data; - } - if (!(boardID in o.file || __indexOf.call(files, boardID) < 0)) { - o.file[boardID] = data; - } - } - } return Redirect.data = o; }, archives: { @@ -10051,8 +10055,8 @@ } }, "warosu": { - boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], + boards: ["3", "biz", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], + files: ["3", "biz", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], data: { domain: "fuuka.warosu.org", http: true, @@ -10081,8 +10085,8 @@ } }, "Foolz Beta": { - boards: ["a", "co", "gd", "jp", "m", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"], + boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"], data: { domain: "beta.foolz.us", http: true, diff --git a/package.json b/package.json index 0232a4576..6aa12d783 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "1.3.8", + "version": "1.3.9", "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X",