From 86cc721a56be1bbaca00dd5e2b5dd3c32540cc84 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 3 Apr 2016 16:48:31 -0700 Subject: [PATCH] Fix behavior of 'Inline Cross-thread Quotes Only' on backlinks to deleted posts, links to hidden posts. #825 --- src/General/Config.coffee | 2 +- src/Quotelinks/QuoteBacklink.coffee | 2 +- src/Quotelinks/QuoteInline.coffee | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 29093c12b..34757afb6 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -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': [ diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index 47401851a..2d49d5efc 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -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' diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index c6b8b5a70..32af6f856 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -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'