Fix navigating between threads via quote hashes (Navigate.coffee part of d2511776419976b0496d1889d697fc86e4bd26fd)

This commit is contained in:
Zixaphir 2014-03-03 00:32:27 -07:00 committed by ccd0
parent 65671b2e2a
commit b29bee8869

View File

@ -22,17 +22,18 @@ Navigate =
replyLink = $ 'a.replylink', @OP.nodes.info
$.on replyLink, 'click', Navigate.navigate
post: ->
post: -> # Allows us to navigate via JSON from thread to thread by hashes and quote highlights.
if Conf['Quote Hash Navigation']
for hashlink in $$ '.hashlink', @nodes.comment
{boardID, threadID, postID} = Get.postDataFromLink hashlink
if boardID isnt g.BOARD.ID or (threadID isnt g.THREADID)
$.on hashlink, 'click', Navigate.navigate
# We don't need to reload the thread inside the thread
return if g.VIEW is 'thread' and @thread.ID is g.THREADID
postlink = $ 'a[title="Link to this post"]', @nodes.info
$.on postlink, 'click', Navigate.navigate
return unless Conf['Quote Hash Navigation']
for hashlink in $$ '.hashlink', @nodes.comment
$.on hashlink, 'click', Navigate.navigate
return
clean: ->
# Garbage collection
g.threads.forEach (thread) -> thread.collect()