diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 0e41a69b6..cfdafb5fa 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -9778,7 +9778,7 @@ Redirect = { init: function() { - var archive, archives, boardID, data, id, name, o, type, _i, _len, _ref, _ref1; + var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _len, _ref; o = { thread: {}, post: {}, @@ -9787,27 +9787,27 @@ archives = Redirect.archives; _ref = Conf['selectedArchives']; for (boardID in _ref) { - data = _ref[boardID]; - for (type in data) { - id = data[type]; - if ((archive = archives[id]) && __indexOf.call(archive[type] || archive['boards'], boardID) >= 0) { + record = _ref[boardID]; + for (type in record) { + id = record[type]; + if ((archive = archives[id]) && __indexOf.call((type === 'file' ? archive['file'] : archive['boards']), boardID) >= 0) { o[type][boardID] = archive.data; } } } 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; + data = archive.data, boards = archive.boards, files = archive.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 || archive.software !== 'foolfuuka')) { + if (!(boardID in o.post || software !== 'foolfuuka')) { o.post[boardID] = data; } - if (!(boardID in o.file || __indexOf.call(archive.files, boardID) < 0)) { + if (!(boardID in o.file || __indexOf.call(files, boardID) < 0)) { o.file[boardID] = data; } } diff --git a/builds/crx/script.js b/builds/crx/script.js index 7ea0a4fab..610c89976 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -9767,7 +9767,7 @@ Redirect = { init: function() { - var archive, archives, boardID, data, id, name, o, type, _i, _len, _ref, _ref1; + var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _len, _ref; o = { thread: {}, post: {}, @@ -9776,31 +9776,32 @@ archives = Redirect.archives; _ref = Conf['selectedArchives']; for (boardID in _ref) { - data = _ref[boardID]; - for (type in data) { - id = data[type]; - if ((archive = archives[id]) && __indexOf.call(archive[type] || archive['boards'], boardID) >= 0) { + record = _ref[boardID]; + for (type in record) { + id = record[type]; + if ((archive = archives[id]) && __indexOf.call((type === 'file' ? archive['file'] : archive['boards']), boardID) >= 0) { o[type][boardID] = archive.data; } } } 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; + data = archive.data, boards = archive.boards, files = archive.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 || archive.software !== 'foolfuuka')) { + if (!(boardID in o.post || software !== 'foolfuuka')) { o.post[boardID] = data; } - if (!(boardID in o.file || __indexOf.call(archive.files, boardID) < 0)) { + if (!(boardID in o.file || __indexOf.call(files, boardID) < 0)) { o.file[boardID] = data; } } } + console.log(o); return Redirect.data = o; }, archives: { diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 54344f789..de9e4a4c3 100755 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -8,20 +8,18 @@ Redirect = {archives} = Redirect - for boardID, data of Conf['selectedArchives'] - for type, id of data when (archive = archives[id]) and boardID in (archive[type] or archive['boards']) + for boardID, record of Conf['selectedArchives'] + for type, id of record when (archive = archives[id]) and boardID in (if type is 'file' then archive['file'] else archive['boards']) o[type][boardID] = archive.data for name, archive of archives - for boardID in archive.boards - {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 - + {data, boards, files} = archive + {software} = data + for boardID in boards + o.thread[boardID] = data unless boardID of o.thread + o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka' + o.file[boardID] = data unless boardID of o.file or boardID not in files + Redirect.data = o archives: