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: ->
{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) ->

View File

@ -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

View File

@ -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'

View File

@ -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/