diff --git a/CHANGELOG.md b/CHANGELOG.md index 89807bc15..3b7bf8d74 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +### v1.4.1 +*2014-03-01* + +**Spittie** +- Check image dimension before uploading + + +- Bug fixes +- Update archives + ## 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 0e8e4ecee..257f532b1 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 @@ -364,7 +364,7 @@ doc = d.documentElement; g = { - VERSION: '1.4.0', + VERSION: '1.4.1', NAMESPACE: '4chan X.', boards: {} }; 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 d1fcaaaff..7022ab53a 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 76d63a4b3..0688673c2 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 @@ -340,7 +340,7 @@ doc = d.documentElement; g = { - VERSION: '1.4.0', + VERSION: '1.4.1', NAMESPACE: '4chan X.', boards: {} }; 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;', "
") }; @@ -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 6ea12749c..76416b1c4 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",