Fix threads highlighted by the filter not being put on top.
This commit is contained in:
parent
11c3b0018a
commit
f0d19e6a5c
@ -110,13 +110,8 @@ Filter =
|
|||||||
|
|
||||||
# Highlight
|
# Highlight
|
||||||
$.addClass @nodes.root, result.class
|
$.addClass @nodes.root, result.class
|
||||||
if !@isReply and result.top and g.VIEW is 'index'
|
if !@isReply and result.top
|
||||||
# Put the highlighted OPs' thread on top of the board page...
|
@thread.isOnTop = true
|
||||||
thisThread = @nodes.root.parentNode
|
|
||||||
# ...before the first non highlighted thread.
|
|
||||||
if firstThread = $ 'div[class="postContainer opContainer"]'
|
|
||||||
unless firstThread is @nodes.root
|
|
||||||
$.before firstThread.parentNode, [thisThread, thisThread.nextElementSibling]
|
|
||||||
|
|
||||||
name: (post) ->
|
name: (post) ->
|
||||||
if 'name' of post.info
|
if 'name' of post.info
|
||||||
|
|||||||
@ -28,6 +28,8 @@ Index =
|
|||||||
|
|
||||||
initReady: ->
|
initReady: ->
|
||||||
$.off d, '4chanXInitFinished', Index.initReady
|
$.off d, '4chanXInitFinished', Index.initReady
|
||||||
|
Index.root = $ '.board'
|
||||||
|
Index.setIndex $$ '.board > .thread, .board > hr', Index.root
|
||||||
return if Conf['Index Mode'] is 'paged'
|
return if Conf['Index Mode'] is 'paged'
|
||||||
Index.update()
|
Index.update()
|
||||||
|
|
||||||
@ -100,8 +102,20 @@ Index =
|
|||||||
Main.callbackNodes Thread, threads
|
Main.callbackNodes Thread, threads
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes Post, posts
|
||||||
|
|
||||||
board = $ '.board'
|
Index.setIndex nodes
|
||||||
$.rmAll board
|
|
||||||
$.add board, nodes
|
|
||||||
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
|
||||||
$.event 'IndexRefresh'
|
$.event 'IndexRefresh'
|
||||||
|
setIndex: (nodes) ->
|
||||||
|
$.rmAll Index.root
|
||||||
|
$.add Index.root, Index.sort nodes
|
||||||
|
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
||||||
|
sort: (nodes) ->
|
||||||
|
return nodes unless Conf['Filter']
|
||||||
|
# Put the highlighted thread on top of the index
|
||||||
|
# while keeping the original order they appear in.
|
||||||
|
tops = []
|
||||||
|
for threadRoot in nodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
||||||
|
tops.push threadRoot
|
||||||
|
for top, i in tops
|
||||||
|
arr = nodes.splice nodes.indexOf(top), 2
|
||||||
|
nodes.splice i * 2, 0, arr...
|
||||||
|
nodes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user