Eliminate redundant network request for reply data for preview in 4chan X catalog.
This commit is contained in:
parent
9cd449cb61
commit
67e7b5ac58
@ -663,6 +663,7 @@ Index =
|
||||
Index.liveThreadDict = {}
|
||||
Index.threadPosition = {}
|
||||
Index.parsedThreads = {}
|
||||
Index.replyData = {}
|
||||
for data, i in Index.liveThreadData
|
||||
Index.liveThreadDict[data.no] = data
|
||||
Index.threadPosition[data.no] = i
|
||||
@ -670,6 +671,9 @@ Index =
|
||||
obj.filterResults = results = Filter.test obj
|
||||
obj.isOnTop = results.top
|
||||
obj.isHidden = results.hide or ThreadHiding.isHidden(obj.boardID, obj.threadID)
|
||||
if data.last_replies
|
||||
for reply in data.last_replies
|
||||
Index.replyData["#{g.BOARD}.#{reply.no}"] = reply
|
||||
if Index.liveThreadData[0]
|
||||
Build.spoilerRange[g.BOARD.ID] = Index.liveThreadData[0].custom_spoiler
|
||||
g.BOARD.threads.forEach (thread) ->
|
||||
|
||||
@ -4,6 +4,16 @@ class Fetcher
|
||||
@insert post
|
||||
return
|
||||
|
||||
# 4chan X catalog data
|
||||
if (post = Index.replyData?["#{@boardID}.#{@postID}"])
|
||||
board = g.boards[@boardID]
|
||||
thread = g.threads["#{@boardID}.#{@threadID}"]
|
||||
post = new Post Build.postFromObject(post, @boardID), thread, board
|
||||
post.isFetchedQuote = true
|
||||
Main.callbackNodes 'Post', [post]
|
||||
@insert post
|
||||
return
|
||||
|
||||
@root.textContent = "Loading post No.#{@postID}..."
|
||||
if @threadID
|
||||
$.cache "//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", (e, isCached) =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user