From f186044a4fa2bc3b39934c297a617c76f15921aa Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 30 Jan 2016 16:52:11 -0800 Subject: [PATCH] Only compute the selected index order. --- src/General/Index.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 056d733b7..79bdf96f6 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -595,18 +595,17 @@ Index = sort: -> {liveThreadIDs, liveThreadData} = Index - sortedThreadIDs = { - lastreply: + sortedThreadIDs = switch Conf['Index Sort'] + when 'lastreply' [liveThreadData...].sort((a, b) -> a = num[num.length - 1] if (num = a.last_replies) b = num[num.length - 1] if (num = b.last_replies) b.no - a.no ).map (post) -> post.no - bump: liveThreadIDs - birth: [liveThreadIDs... ].sort (a, b) -> b - a - replycount: [liveThreadData...].sort((a, b) -> b.replies - a.replies).map (post) -> post.no - filecount: [liveThreadData...].sort((a, b) -> b.images - a.images ).map (post) -> post.no - }[Conf['Index Sort']] + when 'bump' then liveThreadIDs + when 'birth' then [liveThreadIDs... ].sort (a, b) -> b - a + when 'replycount' then [liveThreadData...].sort((a, b) -> b.replies - a.replies).map (post) -> post.no + when 'filecount' then [liveThreadData...].sort((a, b) -> b.images - a.images ).map (post) -> post.no Index.sortedNodes = sortedNodes = [] {nodes} = Index for threadID in sortedThreadIDs