Remember number of replies to contract thread to instead of hardcoding it for each board. #525
This commit is contained in:
parent
5814dadcf7
commit
0176c350a0
@ -58,6 +58,7 @@ ExpandThread =
|
|||||||
return if @ isnt status.req # aborted
|
return if @ isnt status.req # aborted
|
||||||
delete status.req
|
delete status.req
|
||||||
ExpandThread.parse @, thread, a
|
ExpandThread.parse @, thread, a
|
||||||
|
status.numReplies = $$(g.SITE.selectors.postContainer + g.SITE.selectors.relative.replyPost, thread.nodes.root).length
|
||||||
|
|
||||||
contract: (thread, a, threadRoot) ->
|
contract: (thread, a, threadRoot) ->
|
||||||
status = ExpandThread.statuses[thread]
|
status = ExpandThread.statuses[thread]
|
||||||
@ -69,15 +70,7 @@ ExpandThread =
|
|||||||
return
|
return
|
||||||
|
|
||||||
replies = $$ '.thread > .replyContainer', threadRoot
|
replies = $$ '.thread > .replyContainer', threadRoot
|
||||||
if !Conf['JSON Index'] or Conf['Show Replies']
|
replies = replies[...(-status.numReplies)] if status.numReplies
|
||||||
num = if thread.isSticky
|
|
||||||
1
|
|
||||||
else switch g.BOARD.ID
|
|
||||||
# XXX boards config
|
|
||||||
when 'b', 'vg', 'bant' then 3
|
|
||||||
when 't' then 1
|
|
||||||
else 5
|
|
||||||
replies = replies[...-num]
|
|
||||||
postsCount = 0
|
postsCount = 0
|
||||||
filesCount = 0
|
filesCount = 0
|
||||||
for reply in replies
|
for reply in replies
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user