Fix thread watcher/expansion/hiding buttons after an index refresh.
This commit is contained in:
parent
43567173fc
commit
11c3b0018a
@ -2,6 +2,8 @@ ExpandThread =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'index' or !Conf['Thread Expansion']
|
return if g.VIEW isnt 'index' or !Conf['Thread Expansion']
|
||||||
|
|
||||||
|
$.on d, 'IndexRefresh', @onrefresh
|
||||||
|
|
||||||
Thread.callbacks.push
|
Thread.callbacks.push
|
||||||
name: 'Thread Expansion'
|
name: 'Thread Expansion'
|
||||||
cb: @node
|
cb: @node
|
||||||
@ -15,6 +17,11 @@ ExpandThread =
|
|||||||
$.on a, 'click', ExpandThread.cbToggle
|
$.on a, 'click', ExpandThread.cbToggle
|
||||||
$.replace span, a
|
$.replace span, a
|
||||||
|
|
||||||
|
onrefresh: ->
|
||||||
|
for threadID, thread of g.BOARD.threads
|
||||||
|
ExpandThread.node.call thread
|
||||||
|
return
|
||||||
|
|
||||||
text: (status, posts, files) ->
|
text: (status, posts, files) ->
|
||||||
text = [status]
|
text = [status]
|
||||||
text.push "#{posts} post#{if posts > 1 then 's' else ''}"
|
text.push "#{posts} post#{if posts > 1 then 's' else ''}"
|
||||||
|
|||||||
@ -83,7 +83,7 @@ Index =
|
|||||||
nodes.push threadRoot, $.el 'hr'
|
nodes.push threadRoot, $.el 'hr'
|
||||||
unless thread = g.threads["#{g.BOARD}.#{data.no}"]
|
unless thread = g.threads["#{g.BOARD}.#{data.no}"]
|
||||||
thread = new Thread data.no, g.BOARD
|
thread = new Thread data.no, g.BOARD
|
||||||
threads.push thread
|
threads.push thread
|
||||||
for postRoot in $$ '.thread > .postContainer', threadRoot
|
for postRoot in $$ '.thread > .postContainer', threadRoot
|
||||||
continue if thread.posts[postRoot.id.match /\d+/]
|
continue if thread.posts[postRoot.id.match /\d+/]
|
||||||
try
|
try
|
||||||
@ -104,3 +104,4 @@ Index =
|
|||||||
$.rmAll board
|
$.rmAll board
|
||||||
$.add board, nodes
|
$.add board, nodes
|
||||||
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
||||||
|
$.event 'IndexRefresh'
|
||||||
|
|||||||
@ -12,6 +12,7 @@ ThreadWatcher =
|
|||||||
$.on d, 'QRPostSuccessful', @cb.post
|
$.on d, 'QRPostSuccessful', @cb.post
|
||||||
$.on d, 'ThreadUpdate', @cb.threadUpdate if g.VIEW is 'thread'
|
$.on d, 'ThreadUpdate', @cb.threadUpdate if g.VIEW is 'thread'
|
||||||
$.on d, '4chanXInitFinished', @ready
|
$.on d, '4chanXInitFinished', @ready
|
||||||
|
$.on d, 'IndexRefresh', @refresh
|
||||||
|
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
if (@db.data.lastChecked or 0) < now - 2 * $.HOUR
|
if (@db.data.lastChecked or 0) < now - 2 * $.HOUR
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user