From b7585d9cd4950e2281cfab544f4468c80964b0e3 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 3 Mar 2014 02:37:31 -0700 Subject: [PATCH] Lets abandon nesting --- builds/4chan-X.user.js | 15 +++++++-------- builds/crx/script.js | 15 +++++++-------- src/General/Index.coffee | 15 ++++++++------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index c6eadb0a9..fda0e0e1b 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -3238,18 +3238,17 @@ return Index.buildIndex(); }, parseThreadList: function(pages) { - var data, i, j, live, page, thread, threads; + var data, i, live, page, thread; Index.threadsNumPerPage = pages[0].threads.length; live = []; - data = []; i = 0; while (page = pages[i++]) { - j = 0; - threads = page.threads; - live = live.concat(threads); - while (thread = threads[j++]) { - data.push(thread.no); - } + live = live.concat(page.threads); + } + data = []; + i = 0; + while (thread = live[i++]) { + data.push(thread.no); } Index.liveThreadData = live; Index.liveThreadIDs = data; diff --git a/builds/crx/script.js b/builds/crx/script.js index b2c29f162..6b4c8da19 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -3297,18 +3297,17 @@ return Index.buildIndex(); }, parseThreadList: function(pages) { - var data, i, j, live, page, thread, threads; + var data, i, live, page, thread; Index.threadsNumPerPage = pages[0].threads.length; live = []; - data = []; i = 0; while (page = pages[i++]) { - j = 0; - threads = page.threads; - live = live.concat(threads); - while (thread = threads[j++]) { - data.push(thread.no); - } + live = live.concat(page.threads); + } + data = []; + i = 0; + while (thread = live[i++]) { + data.push(thread.no); } Index.liveThreadData = live; Index.liveThreadIDs = data; diff --git a/src/General/Index.coffee b/src/General/Index.coffee index bc1181124..bafe731dc 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -561,15 +561,16 @@ Index = parseThreadList: (pages) -> Index.threadsNumPerPage = pages[0].threads.length + live = [] - data = [] - i = 0 + i = 0 while page = pages[i++] - j = 0 - {threads} = page - live = live.concat threads - while thread = threads[j++] - data.push thread.no + live = live.concat page.threads + + data = [] + i = 0 + while thread = live[i++] + data.push thread.no Index.liveThreadData = live Index.liveThreadIDs = data