Turn archive links into quotelinks. #512

This commit is contained in:
ccd0 2016-05-11 23:39:22 -07:00
parent 9a42bf454e
commit adf1d4716b
2 changed files with 14 additions and 1 deletions

View File

@ -11,10 +11,23 @@ Quotify =
node: ->
return if @isClone
for link in $$ 'a.linkify', @nodes.comment
Quotify.parseArchiveLink.call @, link
for deadlink in $$ '.deadlink', @nodes.comment
Quotify.parseDeadlink.call @, deadlink
return
parseArchiveLink: (link) ->
return unless Redirect.archives.some (o) -> link.host is o.domain
return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?/)
boardID = m[1]
threadID = m[2]
postID = link.hash.match(/^#p?(\d+)$|$/)[1] or threadID
if Redirect.to 'post', {boardID, postID}
$.addClass link, 'quotelink'
$.extend link.dataset, {boardID, threadID, postID}
@nodes.quotelinks.push link
parseDeadlink: (deadlink) ->
if $.hasClass deadlink.parentNode, 'prettyprint'
# Don't quotify deadlinks inside code tags,

View File

@ -547,7 +547,7 @@ Config =
]
'Resurrect Quotes': [
true
'Link dead quotes to the archives.'
'Link dead quotes to the archives, and support inlining/previewing of archive links like quote links.'
]
'Remember Your Posts': [
true