Reduce number of loops in Redirect
This commit is contained in:
parent
2b1a49b02e
commit
cb39424dea
@ -10002,7 +10002,7 @@
|
||||
|
||||
Redirect = {
|
||||
init: function() {
|
||||
var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||
var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
|
||||
o = {
|
||||
thread: {},
|
||||
post: {},
|
||||
@ -10017,6 +10017,19 @@
|
||||
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) {
|
||||
@ -10033,23 +10046,6 @@
|
||||
o[type][boardID] = archive.data;
|
||||
}
|
||||
}
|
||||
_ref3 = Redirect.archives;
|
||||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
||||
_ref4 = _ref3[_j], data = _ref4.data, boards = _ref4.boards, files = _ref4.files;
|
||||
software = data.software;
|
||||
for (_k = 0, _len2 = boards.length; _k < _len2; _k++) {
|
||||
boardID = boards[_k];
|
||||
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: [
|
||||
|
||||
@ -9991,7 +9991,7 @@
|
||||
|
||||
Redirect = {
|
||||
init: function() {
|
||||
var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||
var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
|
||||
o = {
|
||||
thread: {},
|
||||
post: {},
|
||||
@ -10006,6 +10006,19 @@
|
||||
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) {
|
||||
@ -10022,23 +10035,6 @@
|
||||
o[type][boardID] = archive.data;
|
||||
}
|
||||
}
|
||||
_ref3 = Redirect.archives;
|
||||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
||||
_ref4 = _ref3[_j], data = _ref4.data, boards = _ref4.boards, files = _ref4.files;
|
||||
software = data.software;
|
||||
for (_k = 0, _len2 = boards.length; _k < _len2; _k++) {
|
||||
boardID = boards[_k];
|
||||
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: [
|
||||
|
||||
@ -9,6 +9,11 @@ Redirect =
|
||||
archives = {}
|
||||
for {name, boards, files, data} in Redirect.archives
|
||||
archives[name] = {boards, files, data}
|
||||
{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
|
||||
|
||||
for boardID, record of Conf['selectedArchives']
|
||||
for type, id of record when (archive = archives[id])
|
||||
@ -16,13 +21,6 @@ Redirect =
|
||||
continue unless boardID in boards
|
||||
o[type][boardID] = archive.data
|
||||
|
||||
for {data, boards, files} in Redirect.archives
|
||||
{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: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user