Index sort tweak: search before sorting sticky/pinned threads.
That way we only have to sort the matched threads when searching.
This commit is contained in:
parent
06a06686b4
commit
7118c71695
@ -325,18 +325,19 @@ Index =
|
|||||||
for threadID in sortedThreadIDs
|
for threadID in sortedThreadIDs
|
||||||
i = Index.liveThreadIDs.indexOf(threadID) * 2
|
i = Index.liveThreadIDs.indexOf(threadID) * 2
|
||||||
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
|
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
|
||||||
|
if Index.isSearching
|
||||||
|
Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes
|
||||||
# Put the sticky threads on top of the index.
|
# Put the sticky threads on top of the index.
|
||||||
offset = 0
|
offset = 0
|
||||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky
|
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky
|
||||||
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
||||||
if Conf['Filter']
|
return unless Conf['Filter']
|
||||||
# Put the highlighted thread & <hr> 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.
|
||||||
offset = 0
|
offset = 0
|
||||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
||||||
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
||||||
if Index.isSearching
|
return
|
||||||
Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes
|
|
||||||
buildIndex: ->
|
buildIndex: ->
|
||||||
if Conf['Index Mode'] is 'paged'
|
if Conf['Index Mode'] is 'paged'
|
||||||
pageNum = Index.getCurrentPage()
|
pageNum = Index.getCurrentPage()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user