Fix behavior of 'Inline Cross-thread Quotes Only' on backlinks to deleted posts, links to hidden posts. #825

This commit is contained in:
ccd0 2016-04-03 16:48:31 -07:00
parent e7fce8d0ac
commit 86cc721a56
3 changed files with 6 additions and 9 deletions

View File

@ -523,7 +523,7 @@ Config =
]
'Inline Cross-thread Quotes Only': [
false
'Only inline quote links when the posts are on another thread or board, or fetched from the archive.'
'Don\'t inline quote links when the posts are visible in the thread.'
1
]
'Quote Hash Navigation': [

View File

@ -39,7 +39,7 @@ QuoteBacklink =
nodes = if container.firstChild then [$.tn(' '), link] else [link]
if Conf['Quote Previewing']
$.on link, 'mouseover', QuotePreview.mouseover
if Conf['Quote Inlining'] and not (Conf['Inline Cross-thread Quotes Only'] and not QuoteInline.isCrossThread(link))
if Conf['Quote Inlining']
$.on link, 'click', QuoteInline.toggle
if Conf['Quote Hash Navigation']
hash = QuoteInline.qiQuote link, $.hasClass link, 'filtered'

View File

@ -17,16 +17,10 @@ QuoteInline =
return
process: (link, clone) ->
return if Conf['Inline Cross-thread Quotes Only'] and not QuoteInline.isCrossThread(link)
if Conf['Quote Hash Navigation']
$.after link, QuoteInline.qiQuote link, $.hasClass link, 'filtered' unless clone
$.on link, 'click', QuoteInline.toggle
isCrossThread: (link) ->
link.pathname isnt location.pathname or
link.host isnt location.host or
link.protocol isnt location.protocol
qiQuote: (link, hidden) ->
name = "hashlink"
name += " filtered" if hidden
@ -37,8 +31,11 @@ QuoteInline =
toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
e.preventDefault()
{boardID, threadID, postID} = Get.postDataFromLink @
return if Conf['Inline Cross-thread Quotes Only'] and g.VIEW is 'thread' and g.posts["#{boardID}.#{postID}"]?.nodes.root.offsetParent # exists and not hidden
e.preventDefault()
quoter = Get.postFromNode @
{context} = quoter
if $.hasClass @, 'inlined'