diff --git a/LICENSE b/LICENSE index 9b1cd14c9..52e68b1ad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.7.5 - 2014-01-06 +* appchan x - Version 2.7.5 - 2014-01-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 463799254..78190935b 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -22,7 +22,7 @@ // ==/UserScript== /* -* appchan x - Version 2.7.5 - 2014-01-06 +* appchan x - Version 2.7.5 - 2014-01-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -12060,133 +12060,143 @@ }; Redirect = { - data: { - thread: {}, - post: {}, - file: {} - }, init: function() { - var archive, boardID, boards, data, id, name, type, _i, _len, _ref, _ref1, _ref2; + var archive, archives, boardID, data, id, name, o, type, _i, _len, _ref, _ref1; + o = { + thread: {}, + post: {}, + file: {} + }; + archives = Redirect.archives; _ref = Conf['selectedArchives']; for (boardID in _ref) { data = _ref[boardID]; for (type in data) { id = data[type]; - if (archive = Redirect.archives[id]) { - boards = archive[type] || archive['boards']; - if (__indexOf.call(boards, boardID) < 0) { - continue; - } - Redirect.data[type][boardID] = archive; + if ((archive = archives[id]) && __indexOf.call(archive[type] || archive['boards'], boardID) >= 0) { + o[type][boardID] = archive.data; } } } - _ref1 = Redirect.archives; - for (name in _ref1) { - archive = _ref1[name]; - _ref2 = archive.boards; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - boardID = _ref2[_i]; - if (!(boardID in Redirect.data.thread)) { - Redirect.data.thread[boardID] = archive; + for (name in archives) { + archive = archives[name]; + _ref1 = archive.boards; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + boardID = _ref1[_i]; + data = archive.data; + if (!(boardID in o.thread)) { + o.thread[boardID] = data; } - if (!(boardID in Redirect.data.post || archive.software !== 'foolfuuka')) { - Redirect.data.post[boardID] = archive; + if (!(boardID in o.post || archive.software !== 'foolfuuka')) { + o.post[boardID] = data; } - if (!(boardID in Redirect.data.file || __indexOf.call(archive.files, boardID) < 0)) { - Redirect.data.file[boardID] = archive; + if (!(boardID in o.file || __indexOf.call(archive.files, boardID) < 0)) { + o.file[boardID] = data; } } } + return Redirect.data = o; }, archives: { "Foolz": { - domain: "archive.foolz.us", - http: false, - https: true, - software: "foolfuuka", boards: ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"] + files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], + data: { + domain: "archive.foolz.us", + http: false, + https: true, + software: "foolfuuka" + } }, "NSFW Foolz": { - domain: "nsfw.foolz.us", - http: false, - https: true, - software: "foolfuuka", boards: ["u"], - files: ["u"] + files: ["u"], + data: { + domain: "nsfw.foolz.us", + http: false, + https: true, + software: "foolfuuka" + } }, "The Dark Cave": { - domain: "archive.thedarkcave.org", - http: true, - https: true, - software: "foolfuuka", boards: ["c", "int", "out", "po"], - files: ["c", "po"] + files: ["c", "po"], + data: { + domain: "archive.thedarkcave.org", + http: true, + https: true, + software: "foolfuuka" + } }, "4plebs": { - domain: "archive.4plebs.org", - http: true, - https: true, - software: "foolfuuka", boards: ["hr", "pol", "s4s", "tg", "tv", "x"], - files: ["hr", "pol", "s4s", "tg", "tv", "x"] + files: ["hr", "pol", "s4s", "tg", "tv", "x"], + data: { + domain: "archive.4plebs.org", + http: true, + https: true, + software: "foolfuuka" + } }, "Nyafuu": { - domain: "archive.nyafuu.org", - http: true, - https: true, - software: "foolfuuka", boards: ["c", "w", "wg"], - files: ["c", "w", "wg"] + files: ["c", "w", "wg"], + data: { + domain: "archive.nyafuu.org", + http: true, + https: true, + software: "foolfuuka" + } }, "Install Gentoo": { - domain: "archive.installgentoo.net", - http: false, - https: true, - software: "fuuka", boards: ["diy", "g", "sci"], - files: [] + files: [], + data: { + domain: "archive.installgentoo.net", + http: false, + https: true, + software: "fuuka" + } }, "Rebecca Black Tech": { - domain: "rbt.asia", - http: true, - https: true, - software: "fuuka", boards: ["cgl", "g", "mu", "w"], - files: ["cgl", "g", "mu", "w"] + files: ["cgl", "g", "mu", "w"], + data: { + domain: "rbt.asia", + http: true, + https: true, + software: "fuuka" + } }, "Heinessen": { - domain: "archive.heinessen.com", - http: true, - software: "fuuka", boards: ["an", "fit", "k", "mlp", "r9k", "toy"], - files: ["an", "fit", "k", "r9k", "toy"] + files: ["an", "fit", "k", "r9k", "toy"], + data: { + domain: "archive.heinessen.com", + http: true, + software: "fuuka" + } }, "warosu": { - domain: "fuuka.warosu.org", - http: true, - https: true, - software: "fuuka", boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] - }, - "Bui's Archive": { - domain: "archive.bui.pm", - http: true, - https: true, - software: "foolfuuka", - boards: ["b"], - files: ["b"] + files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], + data: { + domain: "fuuka.warosu.org", + http: true, + https: true, + software: "fuuka" + } }, "Foolz Beta": { - domain: "beta.foolz.us", - http: true, - https: true, - withCredentials: true, - software: "foolfuuka", boards: ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"] + files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"], + data: { + domain: "beta.foolz.us", + http: true, + https: true, + withCredentials: true, + software: "foolfuuka" + } } }, to: function(dest, data) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 0783e0426..f1cd8c32a 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.7.5 - 2014-01-06 +* appchan x - Version 2.7.5 - 2014-01-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -12050,133 +12050,143 @@ }; Redirect = { - data: { - thread: {}, - post: {}, - file: {} - }, init: function() { - var archive, boardID, boards, data, id, name, type, _i, _len, _ref, _ref1, _ref2; + var archive, archives, boardID, data, id, name, o, type, _i, _len, _ref, _ref1; + o = { + thread: {}, + post: {}, + file: {} + }; + archives = Redirect.archives; _ref = Conf['selectedArchives']; for (boardID in _ref) { data = _ref[boardID]; for (type in data) { id = data[type]; - if (archive = Redirect.archives[id]) { - boards = archive[type] || archive['boards']; - if (__indexOf.call(boards, boardID) < 0) { - continue; - } - Redirect.data[type][boardID] = archive; + if ((archive = archives[id]) && __indexOf.call(archive[type] || archive['boards'], boardID) >= 0) { + o[type][boardID] = archive.data; } } } - _ref1 = Redirect.archives; - for (name in _ref1) { - archive = _ref1[name]; - _ref2 = archive.boards; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - boardID = _ref2[_i]; - if (!(boardID in Redirect.data.thread)) { - Redirect.data.thread[boardID] = archive; + for (name in archives) { + archive = archives[name]; + _ref1 = archive.boards; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + boardID = _ref1[_i]; + data = archive.data; + if (!(boardID in o.thread)) { + o.thread[boardID] = data; } - if (!(boardID in Redirect.data.post || archive.software !== 'foolfuuka')) { - Redirect.data.post[boardID] = archive; + if (!(boardID in o.post || archive.software !== 'foolfuuka')) { + o.post[boardID] = data; } - if (!(boardID in Redirect.data.file || __indexOf.call(archive.files, boardID) < 0)) { - Redirect.data.file[boardID] = archive; + if (!(boardID in o.file || __indexOf.call(archive.files, boardID) < 0)) { + o.file[boardID] = data; } } } + return Redirect.data = o; }, archives: { "Foolz": { - domain: "archive.foolz.us", - http: false, - https: true, - software: "foolfuuka", boards: ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"] + files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"], + data: { + domain: "archive.foolz.us", + http: false, + https: true, + software: "foolfuuka" + } }, "NSFW Foolz": { - domain: "nsfw.foolz.us", - http: false, - https: true, - software: "foolfuuka", boards: ["u"], - files: ["u"] + files: ["u"], + data: { + domain: "nsfw.foolz.us", + http: false, + https: true, + software: "foolfuuka" + } }, "The Dark Cave": { - domain: "archive.thedarkcave.org", - http: true, - https: true, - software: "foolfuuka", boards: ["c", "int", "out", "po"], - files: ["c", "po"] + files: ["c", "po"], + data: { + domain: "archive.thedarkcave.org", + http: true, + https: true, + software: "foolfuuka" + } }, "4plebs": { - domain: "archive.4plebs.org", - http: true, - https: true, - software: "foolfuuka", boards: ["hr", "pol", "s4s", "tg", "tv", "x"], - files: ["hr", "pol", "s4s", "tg", "tv", "x"] + files: ["hr", "pol", "s4s", "tg", "tv", "x"], + data: { + domain: "archive.4plebs.org", + http: true, + https: true, + software: "foolfuuka" + } }, "Nyafuu": { - domain: "archive.nyafuu.org", - http: true, - https: true, - software: "foolfuuka", boards: ["c", "w", "wg"], - files: ["c", "w", "wg"] + files: ["c", "w", "wg"], + data: { + domain: "archive.nyafuu.org", + http: true, + https: true, + software: "foolfuuka" + } }, "Install Gentoo": { - domain: "archive.installgentoo.net", - http: false, - https: true, - software: "fuuka", boards: ["diy", "g", "sci"], - files: [] + files: [], + data: { + domain: "archive.installgentoo.net", + http: false, + https: true, + software: "fuuka" + } }, "Rebecca Black Tech": { - domain: "rbt.asia", - http: true, - https: true, - software: "fuuka", boards: ["cgl", "g", "mu", "w"], - files: ["cgl", "g", "mu", "w"] + files: ["cgl", "g", "mu", "w"], + data: { + domain: "rbt.asia", + http: true, + https: true, + software: "fuuka" + } }, "Heinessen": { - domain: "archive.heinessen.com", - http: true, - software: "fuuka", boards: ["an", "fit", "k", "mlp", "r9k", "toy"], - files: ["an", "fit", "k", "r9k", "toy"] + files: ["an", "fit", "k", "r9k", "toy"], + data: { + domain: "archive.heinessen.com", + http: true, + software: "fuuka" + } }, "warosu": { - domain: "fuuka.warosu.org", - http: true, - https: true, - software: "fuuka", boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] - }, - "Bui's Archive": { - domain: "archive.bui.pm", - http: true, - https: true, - software: "foolfuuka", - boards: ["b"], - files: ["b"] + files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], + data: { + domain: "fuuka.warosu.org", + http: true, + https: true, + software: "fuuka" + } }, "Foolz Beta": { - domain: "beta.foolz.us", - http: true, - https: true, - withCredentials: true, - software: "foolfuuka", boards: ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], - files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"] + files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"], + data: { + domain: "beta.foolz.us", + http: true, + https: true, + withCredentials: true, + software: "foolfuuka" + } } }, to: function(dest, data) { diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index b6451c6fa..54344f789 100755 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -1,114 +1,119 @@ Redirect = - data: - thread: {} - post: {} - file: {} init: -> + o = + thread: {} + post: {} + file: {} + + {archives} = Redirect + for boardID, data of Conf['selectedArchives'] - for type, id of data - if archive = Redirect.archives[id] - boards = archive[type] or archive['boards'] - continue unless boardID in boards - Redirect.data[type][boardID] = archive - for name, archive of Redirect.archives + for type, id of data when (archive = archives[id]) and boardID in (archive[type] or archive['boards']) + o[type][boardID] = archive.data + + for name, archive of archives for boardID in archive.boards - unless boardID of Redirect.data.thread - Redirect.data.thread[boardID] = archive - unless boardID of Redirect.data.post or archive.software isnt 'foolfuuka' - Redirect.data.post[boardID] = archive - unless boardID of Redirect.data.file or boardID not in archive.files - Redirect.data.file[boardID] = archive - return + {data} = archive + unless boardID of o.thread + o.thread[boardID] = data + unless boardID of o.post or archive.software isnt 'foolfuuka' + o.post[boardID] = data + unless boardID of o.file or boardID not in archive.files + o.file[boardID] = data + + Redirect.data = o archives: "Foolz": - domain: "archive.foolz.us" - http: false - https: true - software: "foolfuuka" boards: ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"] files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"] + data: + domain: "archive.foolz.us" + http: false + https: true + software: "foolfuuka" "NSFW Foolz": - domain: "nsfw.foolz.us" - http: false - https: true - software: "foolfuuka" boards: ["u"] files: ["u"] + data: + domain: "nsfw.foolz.us" + http: false + https: true + software: "foolfuuka" "The Dark Cave": - domain: "archive.thedarkcave.org" - http: true - https: true - software: "foolfuuka" boards: ["c", "int", "out", "po"] files: ["c", "po"] + data: + domain: "archive.thedarkcave.org" + http: true + https: true + software: "foolfuuka" "4plebs": - domain: "archive.4plebs.org" - http: true - https: true - software: "foolfuuka" boards: ["hr", "pol", "s4s", "tg", "tv", "x"] files: ["hr", "pol", "s4s", "tg", "tv", "x"] + data: + domain: "archive.4plebs.org" + http: true + https: true + software: "foolfuuka" "Nyafuu": - domain: "archive.nyafuu.org" - http: true - https: true - software: "foolfuuka" boards: ["c", "w", "wg"] files: ["c", "w", "wg"] + data: + domain: "archive.nyafuu.org" + http: true + https: true + software: "foolfuuka" "Install Gentoo": - domain: "archive.installgentoo.net" - http: false - https: true - software: "fuuka" boards: ["diy", "g", "sci"] files: [] + data: + domain: "archive.installgentoo.net" + http: false + https: true + software: "fuuka" "Rebecca Black Tech": - domain: "rbt.asia" - http: true - https: true - software: "fuuka" boards: ["cgl", "g", "mu", "w"] files: ["cgl", "g", "mu", "w"] + data: + domain: "rbt.asia" + http: true + https: true + software: "fuuka" "Heinessen": - domain: "archive.heinessen.com" - http: true - software: "fuuka" boards: ["an", "fit", "k", "mlp", "r9k", "toy"] files: ["an", "fit", "k", "r9k", "toy"] + data: + domain: "archive.heinessen.com" + http: true + software: "fuuka" "warosu": - domain: "fuuka.warosu.org" - http: true - https: true - software: "fuuka" boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] - - "Bui's Archive": - domain: "archive.bui.pm" - http: true - https: true - software: "foolfuuka" - boards: ["b"] - files: ["b"] + data: + domain: "fuuka.warosu.org" + http: true + https: true + software: "fuuka" "Foolz Beta": - domain: "beta.foolz.us" - http: true - https: true - withCredentials: true - software: "foolfuuka" boards: ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"] + data: + domain: "beta.foolz.us" + http: true + https: true + withCredentials: true + software: "foolfuuka" to: (dest, data) -> archive = (if dest is 'search' then Redirect.data.thread else Redirect.data[dest])[data.boardID]