diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e634a35..47b018eea 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +<<<<<<< HEAD **MayhemYDG**: - Thread and post hiding changes: - The posts' menu now has a label entry listing the reasons why a post got hidden or highlighted. @@ -45,6 +46,17 @@ - Added `Original filename` variable to Sauce panel. - Fixed a bug which prevented QR cooldowns from being pruned from storage. - On Chrome, the storage could reach the quota and prevent 4chan X from saving data like QR name/mail or auto-watch for example. +======= +### v1.4.1 +*2014-03-01* + +**Spittie** +- Check image dimension before uploading + +![Check image dimension](src/General/img/changelog/1.4.1.png) +- Bug fixes +- Update archives +>>>>>>> e8992deab7cecb6e54095bb760613c1cb06b88ca ## v1.4.0 *2014-02-24* diff --git a/LICENSE b/LICENSE index cb025aab5..4e31f841b 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.4.0 - 2014-03-01 +* 4chan X - Version 1.4.1 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE diff --git a/README.md b/README.md index 84604d167..108db645a 100755 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Personal fork of Seaweed's 4chan X. ##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/4chan-X.user.js) (Firefox) ##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/crx.crx) (Chrom*) -##[Install](http://a.pomf.se/iazopu.xpi) (Firefox Mobile) +##[Install](http://a.pomf.se/tkhuwm.xpi) (Firefox Mobile) -## If you have any problems, try resetting your 4chan X settings before calling me a faggot (but feel free to do so) +## If you have any problems, try resetting your 4chan X settings ## Forking diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 440f06af3..c057f780d 100755 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.4.0 +// @version 1.4.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 3551d8856..9516da1d5 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.4.0 +// @version 1.4.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.4.0 - 2014-03-01 +* 4chan X - Version 1.4.1 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -368,7 +368,7 @@ doc = d.documentElement; g = { - VERSION: '1.4.0', + VERSION: '1.4.1', NAMESPACE: '4chan X.', boards: {} }; @@ -6421,12 +6421,30 @@ QR.cleanNotifications(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; - QR.handleFile(file, isSingle, max); + QR.checkDimensions(file, isSingle, max); } if (!isSingle) { return $.addClass(QR.nodes.el, 'dump'); } }, + checkDimensions: function(file, isSingle, max) { + var img; + img = new Image(); + img.onload = (function(_this) { + return function() { + var height, width; + height = img.height, width = img.width; + if (height > QR.max_heigth || width > QR.max_heigth) { + return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)"); + } + if (height < QR.min_heigth || width < QR.min_heigth) { + return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)"); + } + return QR.handleFile(file, isSingle, max); + }; + })(this); + return img.src = URL.createObjectURL(file); + }, handleFile: function(file, isSingle, max) { var post, _ref; if (file.size > max) { @@ -6496,7 +6514,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var dialog, elm, event, i, items, name, node, nodes, save, val, _i, _len, _ref; + var dialog, elm, event, i, items, name, node, nodes, rules, save, val, _, _i, _len, _ref, _ref1, _ref2; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
×
+
No selected file
") }; @@ -6505,6 +6523,15 @@ val = _ref[_i]; nodes[val[0]] = $(val[1], dialog); } + rules = $('ul.rules').textContent.trim(); + QR.min_width = QR.min_heigth = 1; + QR.max_width = QR.max_heigth = 5000; + try { + _ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_heigth = _ref1[2]; + _ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_heigth = _ref2[2]; + } catch (_error) { + null; + } nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { @@ -10787,8 +10814,8 @@ archives: [ { name: "Foolz", - boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], + boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"], data: { domain: "archive.foolz.us", http: false, @@ -10866,8 +10893,8 @@ } }, { name: "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", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"], + files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], data: { domain: "fuuka.warosu.org", https: true, @@ -10893,7 +10920,7 @@ software: "foolfuuka" } }, { - name: "installgentoo.com", + name: "InstallGentoo", boards: ["g", "t"], files: ["g", "t"], data: { @@ -10903,8 +10930,8 @@ } }, { name: "Foolz Beta", - 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"], + boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"], data: { domain: "beta.foolz.us", http: true, diff --git a/builds/crx.crx b/builds/crx.crx index 7ce2c95fc..7bda9ea53 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/manifest.json b/builds/crx/manifest.json index 9d709518f..62a6e1894 100755 --- a/builds/crx/manifest.json +++ b/builds/crx/manifest.json @@ -1,6 +1,6 @@ { "name": "4chan X", - "version": "1.4.0", + "version": "1.4.1", "manifest_version": 2, "description": "Cross-browser userscript for maximum lurking on 4chan.", "icons": { diff --git a/builds/crx/script.js b/builds/crx/script.js index f8540e9af..2aa71f360 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.4.0 - 2014-03-01 +* 4chan X - Version 1.4.1 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -344,7 +344,7 @@ doc = d.documentElement; g = { - VERSION: '1.4.0', + VERSION: '1.4.1', NAMESPACE: '4chan X.', boards: {} }; @@ -6475,12 +6475,30 @@ QR.cleanNotifications(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; - QR.handleFile(file, isSingle, max); + QR.checkDimensions(file, isSingle, max); } if (!isSingle) { return $.addClass(QR.nodes.el, 'dump'); } }, + checkDimensions: function(file, isSingle, max) { + var img; + img = new Image(); + img.onload = (function(_this) { + return function() { + var height, width; + height = img.height, width = img.width; + if (height > QR.max_heigth || width > QR.max_heigth) { + return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)"); + } + if (height < QR.min_heigth || width < QR.min_heigth) { + return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)"); + } + return QR.handleFile(file, isSingle, max); + }; + })(this); + return img.src = URL.createObjectURL(file); + }, handleFile: function(file, isSingle, max) { var post, _ref; if (file.size > max) { @@ -6550,7 +6568,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var dialog, elm, event, i, items, name, node, nodes, save, val, _i, _len, _ref; + var dialog, elm, event, i, items, name, node, nodes, rules, save, val, _, _i, _len, _ref, _ref1, _ref2; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
×
+
No selected file
") }; @@ -6559,6 +6577,15 @@ val = _ref[_i]; nodes[val[0]] = $(val[1], dialog); } + rules = $('ul.rules').textContent.trim(); + QR.min_width = QR.min_heigth = 1; + QR.max_width = QR.max_heigth = 5000; + try { + _ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_heigth = _ref1[2]; + _ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_heigth = _ref2[2]; + } catch (_error) { + null; + } nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { @@ -10801,8 +10828,8 @@ archives: [ { name: "Foolz", - boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], + boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"], data: { domain: "archive.foolz.us", http: false, @@ -10880,8 +10907,8 @@ } }, { name: "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", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"], + files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], data: { domain: "fuuka.warosu.org", https: true, @@ -10907,7 +10934,7 @@ software: "foolfuuka" } }, { - name: "installgentoo.com", + name: "InstallGentoo", boards: ["g", "t"], files: ["g", "t"], data: { @@ -10917,8 +10944,8 @@ } }, { name: "Foolz Beta", - 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"], + boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"], data: { domain: "beta.foolz.us", http: true, diff --git a/builds/xpi/4chanx.xpi b/builds/xpi/4chanx.xpi index a198669bf..896dfe79e 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 c4371e967..257f532b1 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.4.0 +// @version 1.4.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.4.0 - 2014-02-24 +* 4chan X - Version 1.4.1 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -364,7 +364,7 @@ doc = d.documentElement; g = { - VERSION: '1.4.0', + VERSION: '1.4.1', NAMESPACE: '4chan X.', boards: {} }; @@ -2540,7 +2540,7 @@ return Math.max(0, Index.getPagesNum() - 1); }, togglePagelist: function() { - return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages'; + return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged'; }, buildPagelist: function() { var a, i, maxPageNum, nodes, pagesRoot, _i; @@ -5664,7 +5664,10 @@ return { catalog: function() { if (Conf["Persistent QR"]) { - return QR.open(); + QR.open(); + } + if (Conf['Auto Hide QR']) { + return QR.hide(); } }, index: function() { @@ -5985,12 +5988,29 @@ QR.cleanNotifications(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; - QR.handleFile(file, isSingle, max); + QR.checkDimensions(file, isSingle, max); } if (!isSingle) { return $.addClass(QR.nodes.el, 'dump'); } }, + checkDimensions: function(file, isSingle, max) { + var img, + _this = this; + img = new Image(); + img.onload = function() { + var height, width; + height = img.height, width = img.width; + if (height > QR.max_heigth || width > QR.max_heigth) { + return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)"); + } + if (height < QR.min_heigth || width < QR.min_heigth) { + return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)"); + } + return QR.handleFile(file, isSingle, max); + }; + return img.src = URL.createObjectURL(file); + }, handleFile: function(file, isSingle, max) { var post, _ref; if (file.size > max) { @@ -6060,7 +6080,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var dialog, elm, event, i, items, key, name, node, nodes, save, value, _ref; + var dialog, elm, event, i, items, key, max_heigth, max_width, min_heigth, min_width, name, node, nodes, rules, save, tmp_dim, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
×
+
No selected file
") }; @@ -6094,6 +6114,23 @@ value = _ref[key]; nodes[key] = $(value, dialog); } + rules = $('ul.rules').textContent.trim(); + try { + tmp_dim = rules.match(/.+smaller than (\d+)x(\d+).+/); + min_width = tmp_dim[1]; + min_heigth = tmp_dim[2]; + } catch (_error) { + min_width = 1; + min_heigth = 1; + } + try { + tmp_dim = rules.match(/.+greater than (\d+)x(\d+).+/); + max_width = tmp_dim[1]; + max_heigth = tmp_dim[2]; + } catch (_error) { + QR.max_width = 5000; + QR.max_heigth = 5000; + } nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; QR.spoiler = !!$('input[name=spoiler]'); if (QR.spoiler) { @@ -6346,6 +6383,8 @@ if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') { if (/mistyped/i.test(err.textContent)) { err = 'You seem to have mistyped the CAPTCHA.'; + } else if (/expired/i.test(err.textContent)) { + err = 'This CAPTCHA is no longer valid because it has expired.'; } QR.cooldown.auto = QR.captcha.isEnabled ? !!QR.captcha.captchas.length : err === 'Connection error with sys.4chan.org.' ? true : false; QR.cooldown.set({ @@ -10303,8 +10342,8 @@ archives: [ { name: "Foolz", - boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], + boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"], data: { domain: "archive.foolz.us", http: false, @@ -10382,8 +10421,8 @@ } }, { name: "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", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"], + files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], data: { domain: "fuuka.warosu.org", https: true, @@ -10409,7 +10448,7 @@ software: "foolfuuka" } }, { - name: "installgentoo.com", + name: "InstallGentoo", boards: ["g", "t"], files: ["g", "t"], data: { @@ -10419,236 +10458,8 @@ } }, { name: "Foolz Beta", - 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, - https: true, - withCredentials: true, - software: "foolfuuka" - } - } - ], - to: function(dest, data) { - var archive; - archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; - if (!archive) { - return ''; - } - return Redirect[dest](archive, data); - }, - protocol: function(archive) { - var protocol; - protocol = location.protocol; - if (!archive[protocol.slice(0, -1)]) { - protocol = protocol === 'https:' ? 'http:' : 'https:'; - } - return "" + protocol + "//"; - }, - thread: function(archive, _arg) { - var boardID, path, postID, threadID; - boardID = _arg.boardID, threadID = _arg.threadID, postID = _arg.postID; - path = threadID ? "" + boardID + "/thread/" + threadID : "" + boardID + "/post/" + postID; - if (archive.software === 'foolfuuka') { - path += '/'; - } - if (threadID && postID) { - path += archive.software === 'foolfuuka' ? "#" + postID : "#p" + postID; - } - return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path; - }, - post: function(archive, _arg) { - var URL, boardID, postID; - boardID = _arg.boardID, postID = _arg.postID; - URL = new String("" + (Redirect.protocol(archive)) + archive.domain + "/_/api/chan/post/?board=" + boardID + "&num=" + postID); - URL.archive = archive; - return URL; - }, - file: function(archive, _arg) { - var boardID, filename; - boardID = _arg.boardID, filename = _arg.filename; - return "" + (Redirect.protocol(archive)) + archive.domain + "/" + boardID + "/full_image/" + filename; - }, - search: function(archive, _arg) { - var boardID, path, type, value; - boardID = _arg.boardID, type = _arg.type, value = _arg.value; - type = type === 'name' ? 'username' : type === 'MD5' ? 'image' : type; - value = encodeURIComponent(value); - path = archive.software === 'foolfuuka' ? "" + boardID + "/search/" + type + "/" + value : "" + boardID + "/?task=search2&search_" + (type === 'image' ? 'media_hash' : type) + "=" + value; - return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path; - } - }; - - Redirect = { - init: function() { - 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 = {}; - _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]))) { - continue; - } - boards = type === 'file' ? archive.files : archive.boards; - if (__indexOf.call(boards, boardID) < 0) { - continue; - } - o[type][boardID] = archive.data; - } - } - return Redirect.data = o; - }, - archives: [ - { - name: "Foolz", - boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], - data: { - domain: "archive.foolz.us", - http: false, - https: true, - software: "foolfuuka" - } - }, { - name: "NSFW Foolz", - boards: ["u"], - files: ["u"], - data: { - domain: "nsfw.foolz.us", - http: false, - https: true, - software: "foolfuuka" - } - }, { - name: "The Dark Cave", - boards: ["c", "int", "out", "po"], - files: ["c", "po"], - data: { - domain: "archive.thedarkcave.org", - http: true, - https: true, - software: "foolfuuka" - } - }, { - name: "4plebs", - boards: ["adv", "hr", "o", "pol", "s4s", "tg", "tv", "x"], - files: ["adv", "hr", "o", "pol", "s4s", "tg", "tv", "x"], - data: { - domain: "archive.4plebs.org", - http: true, - https: true, - software: "foolfuuka" - } - }, { - name: "Nyafuu", - boards: ["c", "e", "w", "wg"], - files: ["c", "e", "w", "wg"], - data: { - domain: "archive.nyafuu.org", - http: true, - https: true, - software: "foolfuuka" - } - }, { - name: "Love is Over", - boards: ["d", "i"], - files: ["d", "i"], - data: { - domain: "loveisover.me", - http: true, - https: true, - software: "foolfuuka" - } - }, { - name: "Rebecca Black Tech", - boards: ["cgl", "g", "mu", "w"], - files: ["cgl", "g", "mu", "w"], - data: { - domain: "archive.rebeccablacktech.com", - http: true, - https: true, - software: "fuuka" - } - }, { - name: "Heinessen", - boards: ["an", "fit", "k", "mlp", "r9k", "toy"], - files: ["an", "fit", "k", "r9k", "toy"], - data: { - domain: "archive.heinessen.com", - http: true, - software: "fuuka" - } - }, { - name: "warosu", - boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - data: { - domain: "fuuka.warosu.org", - https: true, - software: "fuuka" - } - }, { - name: "fgts", - boards: ["r", "soc"], - files: ["r", "soc"], - data: { - domain: "fgst.eu", - http: true, - https: true, - software: "foolfuuka" - } - }, { - name: "maware", - boards: ["t"], - files: ["t"], - data: { - domain: "archive.mawa.re", - http: true, - software: "foolfuuka" - } - }, { - name: "installgentoo.com", - boards: ["g", "t"], - files: ["g", "t"], - data: { - domain: "chan.installgentoo.com", - http: true, - software: "foolfuuka" - } - }, { - name: "Foolz Beta", - 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"], + boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"], data: { domain: "beta.foolz.us", http: true, @@ -12622,7 +12433,7 @@ }, navigate: function(e) { var boardID, load, pageNum, path, threadID, view; - if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) { + if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || e.ctrlKey || (e.type === 'click' && e.button !== 0)))) { return; } $.addClass(Index.button, 'fa-spin'); diff --git a/builds/xpi/package.json b/builds/xpi/package.json index 00bd4cdce..916a4ee38 100644 --- a/builds/xpi/package.json +++ b/builds/xpi/package.json @@ -5,5 +5,5 @@ "description": "Adds various features to 4chan.", "author": "Spittie", "license": "MIT", - "version": "1.3.7" + "version": "1.4.1" } diff --git a/latest.js b/latest.js index 7d0ac1c56..3b382428a 100755 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'1.4.0'},'*') +postMessage({version:'1.4.1'},'*') diff --git a/package.json b/package.json index a95d59e77..3e5f4c45d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "1.4.0", + "version": "1.4.1", "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 8f738649b..84c37b2ba 100755 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -24,8 +24,8 @@ Redirect = archives: [ name: "Foolz" - boards: ["a", "biz","co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"] - files: ["a", "biz","gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"] + boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"] + files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"] data: domain: "archive.foolz.us" http: false @@ -95,8 +95,8 @@ Redirect = software: "fuuka" , name: "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", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"] + files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"] data: domain: "fuuka.warosu.org" https: true @@ -119,7 +119,7 @@ Redirect = http: true software: "foolfuuka" , - name: "installgentoo.com" + name: "InstallGentoo" boards: ["g", "t"] files: ["g", "t"] data: @@ -128,8 +128,8 @@ Redirect = software: "foolfuuka" , name: "Foolz Beta" - 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"] + boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"] data: domain: "beta.foolz.us" http: true diff --git a/src/General/img/changelog/1.4.1.png b/src/General/img/changelog/1.4.1.png new file mode 100644 index 000000000..817b58eb5 Binary files /dev/null and b/src/General/img/changelog/1.4.1.png differ diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 6a8ace175..7b35ced69 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -378,9 +378,18 @@ QR = isSingle = files.length is 1 QR.cleanNotifications() for file in files - QR.handleFile file, isSingle, max + QR.checkDimensions file, isSingle, max $.addClass QR.nodes.el, 'dump' unless isSingle + checkDimensions: (file, isSingle, max) -> + img = new Image() + img.onload = => + {height, width} = img + return QR.error "#{file.name}: Image too large (image: #{img.height}x#{img.width}px, max: #{QR.max_heigth}x#{QR.max_width}px)" if height > QR.max_heigth or width > QR.max_heigth + return QR.error "#{file.name}: Image too small (image: #{img.height}x#{img.width}px, min: #{QR.min_heigth}x#{QR.min_width}px)" if height < QR.min_heigth or width < QR.min_heigth + QR.handleFile file, isSingle, max + img.src = URL.createObjectURL file + handleFile: (file, isSingle, max) -> if file.size > max QR.error "#{file.name}: File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})." @@ -462,6 +471,15 @@ QR = ['status', '[type=submit]'] ['fileInput', '[type=file]'] ] + + rules = $('ul.rules').textContent.trim() + QR.min_width = QR.min_heigth = 1 + QR.max_width = QR.max_heigth = 5000 + try + [_, QR.min_width, QR.min_heigth] = rules.match(/.+smaller than (\d+)x(\d+).+/) + [_, QR.max_width, QR.max_heigth] = rules.match(/.+greater than (\d+)x(\d+).+/) + catch + null nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value