We only have to look for one thread when visiting thread pages.

This commit is contained in:
Mayhem 2013-11-03 16:47:22 +01:00
parent b8dac71456
commit bddb032dac
2 changed files with 14 additions and 20 deletions

View File

@ -202,8 +202,7 @@ Index =
posts.push new Post postRoot, thread, g.BOARD posts.push new Post postRoot, thread, g.BOARD
catch err catch err
# Skip posts that we failed to parse. # Skip posts that we failed to parse.
unless errors errors = [] unless errors
errors = []
errors.push errors.push
message: "Parsing of Post No.#{postRoot.id.match /\d+/} failed. Post will be skipped." message: "Parsing of Post No.#{postRoot.id.match /\d+/} failed. Post will be skipped."
error: err error: err

View File

@ -169,26 +169,21 @@ Main =
# Something might have gone wrong! # Something might have gone wrong!
Main.initStyle() Main.initStyle()
if g.VIEW is 'thread' and board = $ '.board' if g.VIEW is 'thread' and threadRoot = $ '.thread'
threads = [] thread = new Thread +threadRoot.id[1..], g.BOARD
posts = [] posts = []
for postRoot in $$ '.thread > .postContainer', threadRoot
for threadRoot in $$ '.board > .thread', board try
thread = new Thread +threadRoot.id[1..], g.BOARD posts.push new Post postRoot, thread, g.BOARD
threads.push thread catch err
for postRoot in $$ '.thread > .postContainer', threadRoot # Skip posts that we failed to parse.
try errors = [] unless errors
posts.push new Post postRoot, thread, g.BOARD errors.push
catch err message: "Parsing of Post No.#{postRoot.id.match /\d+/} failed. Post will be skipped."
# Skip posts that we failed to parse. error: err
unless errors
errors = []
errors.push
message: "Parsing of Post No.#{postRoot.id.match /\d+/} failed. Post will be skipped."
error: err
Main.handleErrors errors if errors Main.handleErrors errors if errors
Main.callbackNodes Thread, threads Main.callbackNodes Thread, [thread]
Main.callbackNodes Post, posts Main.callbackNodes Post, posts
if $.hasClass d.body, 'fourchan_x' if $.hasClass d.body, 'fourchan_x'