Better thread data lookup.
This commit is contained in:
parent
84b7f546a5
commit
3a568ab366
@ -183,7 +183,7 @@ Build =
|
|||||||
|
|
||||||
catalogThread: (thread) ->
|
catalogThread: (thread) ->
|
||||||
{staticPath, gifIcon} = Build
|
{staticPath, gifIcon} = Build
|
||||||
data = Index.liveThreadData[Index.liveThreadIDs.indexOf thread.ID]
|
data = Index.liveThreadDict[thread.ID]
|
||||||
|
|
||||||
if data.spoiler and !Conf['Reveal Spoiler Thumbnails']
|
if data.spoiler and !Conf['Reveal Spoiler Thumbnails']
|
||||||
src = "#{staticPath}spoiler"
|
src = "#{staticPath}spoiler"
|
||||||
|
|||||||
@ -562,6 +562,9 @@ Index =
|
|||||||
Index.threadsNumPerPage = pages[0]?.threads.length or 1
|
Index.threadsNumPerPage = pages[0]?.threads.length or 1
|
||||||
Index.liveThreadData = pages.reduce ((arr, next) -> arr.concat next.threads), []
|
Index.liveThreadData = pages.reduce ((arr, next) -> arr.concat next.threads), []
|
||||||
Index.liveThreadIDs = Index.liveThreadData.map (data) -> data.no
|
Index.liveThreadIDs = Index.liveThreadData.map (data) -> data.no
|
||||||
|
Index.liveThreadDict = {}
|
||||||
|
for data in Index.liveThreadData
|
||||||
|
Index.liveThreadDict[data.no] = data
|
||||||
if Index.liveThreadData[0]
|
if Index.liveThreadData[0]
|
||||||
Build.spoilerRange[g.BOARD.ID] = Index.liveThreadData[0].custom_spoiler
|
Build.spoilerRange[g.BOARD.ID] = Index.liveThreadData[0].custom_spoiler
|
||||||
g.BOARD.threads.forEach (thread) ->
|
g.BOARD.threads.forEach (thread) ->
|
||||||
@ -606,8 +609,7 @@ Index =
|
|||||||
buildReplies: (threads) ->
|
buildReplies: (threads) ->
|
||||||
posts = []
|
posts = []
|
||||||
for thread in threads
|
for thread in threads
|
||||||
i = Index.liveThreadIDs.indexOf thread.ID
|
continue unless lastReplies = Index.liveThreadDict[thread.ID].last_replies
|
||||||
continue unless lastReplies = Index.liveThreadData[i].last_replies
|
|
||||||
nodes = []
|
nodes = []
|
||||||
for data in lastReplies
|
for data in lastReplies
|
||||||
if (post = thread.posts[data.no]) and not post.isFetchedQuote
|
if (post = thread.posts[data.no]) and not post.isFetchedQuote
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user