Turn archive links into quotelinks. #512
This commit is contained in:
parent
9a42bf454e
commit
adf1d4716b
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user