Reflow Navigate.node, allow navigation from backlinks and their hashes
Conflicts: builds/4chan-X.user.js builds/crx/script.js src/General/Navigate.coffee src/Quotelinks/QuoteBacklink.coffee
This commit is contained in:
parent
635fbaa377
commit
3b04eb6e2a
@ -23,16 +23,29 @@ Navigate =
|
|||||||
$.on replyLink, 'click', Navigate.navigate
|
$.on replyLink, 'click', Navigate.navigate
|
||||||
|
|
||||||
post: -> # Allows us to navigate via JSON from thread to thread by hashes and quote highlights.
|
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
|
# We don't need to reload the thread inside the thread
|
||||||
return if g.VIEW is 'thread' and @thread.ID is g.THREADID
|
unless g.VIEW is 'thread' and @thread.ID is g.THREADID
|
||||||
postlink = $ 'a[title="Link to this post"]', @nodes.info
|
$.on $('a[title="Link to this post"]', @nodes.info), 'click', Navigate.navigate
|
||||||
$.on postlink, 'click', Navigate.navigate
|
|
||||||
|
return unless (linktype = if Conf['Quote Inlining'] and Conf['Quote Hash Navigation']
|
||||||
|
'.hashlink'
|
||||||
|
else if !Conf['Quote Inlining']
|
||||||
|
'.quotelink'
|
||||||
|
else
|
||||||
|
null
|
||||||
|
)
|
||||||
|
|
||||||
|
Navigate.quoteLink $$ linktype, @nodes.comment
|
||||||
|
|
||||||
|
quoteLink: (links) ->
|
||||||
|
for link in links
|
||||||
|
Navigate.singleQuoteLink link
|
||||||
|
return
|
||||||
|
|
||||||
|
singleQuoteLink: (link) ->
|
||||||
|
{boardID, threadID} = Get.postDataFromLink link
|
||||||
|
if g.VIEW is 'index' or boardID isnt g.BOARD.ID or threadID isnt g.THREADID
|
||||||
|
$.on link, 'click', Navigate.navigate
|
||||||
|
|
||||||
clean: ->
|
clean: ->
|
||||||
# Garbage collection
|
# Garbage collection
|
||||||
|
|||||||
@ -42,7 +42,14 @@ QuoteBacklink =
|
|||||||
$.on link, 'mouseover', QuotePreview.mouseover
|
$.on link, 'mouseover', QuotePreview.mouseover
|
||||||
if Conf['Quote Inlining']
|
if Conf['Quote Inlining']
|
||||||
$.on link, 'click', QuoteInline.toggle
|
$.on link, 'click', QuoteInline.toggle
|
||||||
nodes.push QuoteInline.qiQuote link, $.hasClass link, 'filtered' if Conf['Quote Hash Navigation']
|
if Conf['Quote Hash Navigation']
|
||||||
|
hash = QuoteInline.qiQuote link, $.hasClass link, 'filtered'
|
||||||
|
nodes.push hash
|
||||||
|
if Conf['JSON Navigation']
|
||||||
|
if hash
|
||||||
|
Navigate.singleQuoteLink hash
|
||||||
|
else unless Conf['Quote Inlining']
|
||||||
|
Navigate.singleQuoteLink link
|
||||||
$.add container, nodes
|
$.add container, nodes
|
||||||
return
|
return
|
||||||
secondNode: ->
|
secondNode: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user