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
catch err
# Skip posts that we failed to parse.
unless errors
errors = []
errors = [] unless errors
errors.push
message: "Parsing of Post No.#{postRoot.id.match /\d+/} failed. Post will be skipped."
error: err

View File

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