Put archive links in separate collection from quote links so features such as quote markers aren't run on them.

This commit is contained in:
ccd0 2016-05-13 23:12:14 -07:00
parent 061d42bc93
commit 64d0bd0afd
4 changed files with 10 additions and 7 deletions

View File

@ -12,8 +12,8 @@ QuoteInline =
node: -> node: ->
{process} = QuoteInline {process} = QuoteInline
{isClone} = @ {isClone} = @
process link, isClone for link in @nodes.quotelinks for link in @nodes.quotelinks.concat [@nodes.backlinks...], @nodes.archivelinks
process link, isClone for link in @nodes.backlinks process link, isClone
return return
process: (link, clone) -> process: (link, clone) ->

View File

@ -10,7 +10,7 @@ QuotePreview =
cb: @node cb: @node
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 $.on link, 'mouseover', QuotePreview.mouseover
return return

View File

@ -10,14 +10,16 @@ Quotify =
cb: @node cb: @node
node: -> node: ->
return if @isClone if @isClone
@nodes.archivelinks = $$ 'a.linkify.quotelink', @nodes.comment
return
for link in $$ 'a.linkify', @nodes.comment for link in $$ 'a.linkify', @nodes.comment
Quotify.parseArchiveLink.call @, link Quotify.parseArchivelink.call @, link
for deadlink in $$ '.deadlink', @nodes.comment for deadlink in $$ '.deadlink', @nodes.comment
Quotify.parseDeadlink.call @, deadlink Quotify.parseDeadlink.call @, deadlink
return return
parseArchiveLink: (link) -> parseArchivelink: (link) ->
return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?$/) return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?$/)
boardID = m[1] boardID = m[1]
threadID = m[2] threadID = m[2]
@ -25,7 +27,7 @@ Quotify =
if Redirect.to 'post', {boardID, postID} if Redirect.to 'post', {boardID, postID}
$.addClass link, 'quotelink' $.addClass link, 'quotelink'
$.extend link.dataset, {boardID, threadID, postID} $.extend link.dataset, {boardID, threadID, postID}
@nodes.quotelinks.push link @nodes.archivelinks.push link
parseDeadlink: (deadlink) -> parseDeadlink: (deadlink) ->
if $.hasClass deadlink.parentNode, 'prettyprint' if $.hasClass deadlink.parentNode, 'prettyprint'

View File

@ -72,6 +72,7 @@ class Post
comment: $ '.postMessage', post comment: $ '.postMessage', post
links: [] links: []
quotelinks: [] quotelinks: []
archivelinks: []
# XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node. # XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node.
# https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7560353/ # https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7560353/