From 64d0bd0afd17a888307711aefe13c67acb412026 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 13 May 2016 23:12:14 -0700 Subject: [PATCH] Put archive links in separate collection from quote links so features such as quote markers aren't run on them. --- src/Quotelinks/QuoteInline.coffee | 4 ++-- src/Quotelinks/QuotePreview.coffee | 2 +- src/Quotelinks/Quotify.coffee | 10 ++++++---- src/classes/Post.coffee | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 7f9162de0..7e2f5a554 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -12,8 +12,8 @@ QuoteInline = node: -> {process} = QuoteInline {isClone} = @ - process link, isClone for link in @nodes.quotelinks - process link, isClone for link in @nodes.backlinks + for link in @nodes.quotelinks.concat [@nodes.backlinks...], @nodes.archivelinks + process link, isClone return process: (link, clone) -> diff --git a/src/Quotelinks/QuotePreview.coffee b/src/Quotelinks/QuotePreview.coffee index 3e8e5a271..123f86406 100644 --- a/src/Quotelinks/QuotePreview.coffee +++ b/src/Quotelinks/QuotePreview.coffee @@ -10,7 +10,7 @@ QuotePreview = cb: @node node: -> - for link in @nodes.quotelinks.concat [@nodes.backlinks...] + for link in @nodes.quotelinks.concat [@nodes.backlinks...], @nodes.archivelinks $.on link, 'mouseover', QuotePreview.mouseover return diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 6fa611cbb..bf4cf30b0 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -10,14 +10,16 @@ Quotify = cb: @node node: -> - return if @isClone + if @isClone + @nodes.archivelinks = $$ 'a.linkify.quotelink', @nodes.comment + return for link in $$ 'a.linkify', @nodes.comment - Quotify.parseArchiveLink.call @, link + Quotify.parseArchivelink.call @, link for deadlink in $$ '.deadlink', @nodes.comment Quotify.parseDeadlink.call @, deadlink return - parseArchiveLink: (link) -> + parseArchivelink: (link) -> return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?$/) boardID = m[1] threadID = m[2] @@ -25,7 +27,7 @@ Quotify = if Redirect.to 'post', {boardID, postID} $.addClass link, 'quotelink' $.extend link.dataset, {boardID, threadID, postID} - @nodes.quotelinks.push link + @nodes.archivelinks.push link parseDeadlink: (deadlink) -> if $.hasClass deadlink.parentNode, 'prettyprint' diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index 99abd1902..332144ec5 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -72,6 +72,7 @@ class Post comment: $ '.postMessage', post links: [] quotelinks: [] + archivelinks: [] # XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node. # https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7560353/