Reduce Index.sort() to 1 loop.
This commit is contained in:
parent
21e6902762
commit
553c475768
@ -122,14 +122,14 @@ Index =
|
|||||||
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
||||||
sort: (nodes) ->
|
sort: (nodes) ->
|
||||||
return nodes unless Conf['Filter']
|
return nodes unless Conf['Filter']
|
||||||
# Put the highlighted thread on top of the index
|
# Put the highlighted thread & <hr> on top of the index
|
||||||
# while keeping the original order they appear in.
|
# while keeping the original order they appear in.
|
||||||
tops = []
|
i = offset = 0
|
||||||
for threadRoot in nodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
while threadRoot = nodes[i]
|
||||||
tops.push threadRoot
|
if Get.threadFromRoot(threadRoot).isOnTop
|
||||||
for top, i in tops
|
nodes.splice offset, 0, nodes.splice(i, 2)...
|
||||||
arr = nodes.splice nodes.indexOf(top), 2
|
offset += 2
|
||||||
nodes.splice i * 2, 0, arr...
|
i += 2
|
||||||
nodes
|
nodes
|
||||||
|
|
||||||
collectDeadThreads: (liveThreads) ->
|
collectDeadThreads: (liveThreads) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user