Fix dead quotelinks inside clones.
This commit is contained in:
parent
abaf10e101
commit
6a8ebfed0d
@ -1,4 +1,5 @@
|
|||||||
- Fix support for www.4chan.org/frames on Chrome.
|
- Fix support for www.4chan.org/frames on Chrome.
|
||||||
|
- Fix quote features not working on dead quotelinks in inlined posts.
|
||||||
- Fix resurrecting dead quotelinks on HTTP.
|
- Fix resurrecting dead quotelinks on HTTP.
|
||||||
|
|
||||||
### 3.0.6 - *2013-04-14*
|
### 3.0.6 - *2013-04-14*
|
||||||
|
|||||||
@ -6,8 +6,7 @@ UI = do ->
|
|||||||
id: id
|
id: id
|
||||||
$.get "#{id}.position", position, (item) ->
|
$.get "#{id}.position", position, (item) ->
|
||||||
el.style.cssText = item["#{id}.position"]
|
el.style.cssText = item["#{id}.position"]
|
||||||
move = $ '.move', el
|
$.on $('.move', el), 'touchstart mousedown', dragstart
|
||||||
$.on move, 'touchstart mousedown', dragstart
|
|
||||||
el
|
el
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2606,67 +2606,70 @@ Quotify =
|
|||||||
name: 'Resurrect Quotes'
|
name: 'Resurrect Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: ->
|
node: ->
|
||||||
return if @isClone
|
|
||||||
for deadlink in $$ '.deadlink', @nodes.comment
|
for deadlink in $$ '.deadlink', @nodes.comment
|
||||||
if deadlink.parentNode.className is 'prettyprint'
|
if @isClone
|
||||||
# Don't quotify deadlinks inside code tags,
|
if $.hasClass deadlink, 'quotelink'
|
||||||
# un-`span` them.
|
@nodes.quotelinks.push deadlink
|
||||||
$.replace deadlink, [deadlink.childNodes...]
|
else
|
||||||
continue
|
Quotify.parseDeadlink.call @, deadlink
|
||||||
|
return
|
||||||
|
|
||||||
quote = deadlink.textContent
|
parseDeadlink: (deadlink) ->
|
||||||
continue unless postID = quote.match(/\d+$/)?[0]
|
if deadlink.parentNode.className is 'prettyprint'
|
||||||
boardID =
|
# Don't quotify deadlinks inside code tags,
|
||||||
if m = quote.match /^>>>\/([a-z\d]+)/
|
# un-`span` them.
|
||||||
m[1]
|
$.replace deadlink, [deadlink.childNodes...]
|
||||||
else
|
return
|
||||||
@board.ID
|
|
||||||
quoteID = "#{boardID}.#{postID}"
|
|
||||||
|
|
||||||
# \u00A0 is nbsp
|
quote = deadlink.textContent
|
||||||
if post = g.posts[quoteID]
|
return unless postID = quote.match(/\d+$/)?[0]
|
||||||
unless post.isDead
|
boardID = if m = quote.match /^>>>\/([a-z\d]+)/
|
||||||
# Don't (Dead) when quotifying in an archived post,
|
m[1]
|
||||||
# and we know the post still exists.
|
else
|
||||||
a = $.el 'a',
|
@board.ID
|
||||||
href: "/#{boardID}/#{post.thread}/res/#p#{postID}"
|
quoteID = "#{boardID}.#{postID}"
|
||||||
className: 'quotelink'
|
|
||||||
textContent: quote
|
if post = g.posts[quoteID]
|
||||||
else
|
unless post.isDead
|
||||||
# Replace the .deadlink span if we can redirect.
|
# Don't (Dead) when quotifying in an archived post,
|
||||||
a = $.el 'a',
|
# and we know the post still exists.
|
||||||
href: "/#{boardID}/#{post.thread}/res/#p#{postID}"
|
a = $.el 'a',
|
||||||
className: 'quotelink deadlink'
|
href: "/#{boardID}/#{post.thread}/res/#p#{postID}"
|
||||||
target: '_blank'
|
className: 'quotelink'
|
||||||
textContent: "#{quote}\u00A0(Dead)"
|
textContent: quote
|
||||||
a.setAttribute 'data-boardid', boardID
|
else
|
||||||
a.setAttribute 'data-threadid', post.thread.ID
|
|
||||||
a.setAttribute 'data-postid', postID
|
|
||||||
else if redirect = Redirect.to {boardID, threadID: 0, postID}
|
|
||||||
# Replace the .deadlink span if we can redirect.
|
# Replace the .deadlink span if we can redirect.
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
href: redirect
|
href: "/#{boardID}/#{post.thread}/res/#p#{postID}"
|
||||||
className: 'deadlink'
|
className: 'quotelink deadlink'
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
textContent: "#{quote}\u00A0(Dead)"
|
textContent: "#{quote}\u00A0(Dead)"
|
||||||
if Redirect.post boardID, postID
|
a.setAttribute 'data-boardid', boardID
|
||||||
# Make it function as a normal quote if we can fetch the post.
|
a.setAttribute 'data-threadid', post.thread.ID
|
||||||
$.addClass a, 'quotelink'
|
a.setAttribute 'data-postid', postID
|
||||||
a.setAttribute 'data-boardid', boardID
|
else if redirect = Redirect.to {boardID, threadID: 0, postID}
|
||||||
a.setAttribute 'data-postid', postID
|
# Replace the .deadlink span if we can redirect.
|
||||||
|
a = $.el 'a',
|
||||||
|
href: redirect
|
||||||
|
className: 'deadlink'
|
||||||
|
target: '_blank'
|
||||||
|
textContent: "#{quote}\u00A0(Dead)"
|
||||||
|
if Redirect.post boardID, postID
|
||||||
|
# Make it function as a normal quote if we can fetch the post.
|
||||||
|
$.addClass a, 'quotelink'
|
||||||
|
a.setAttribute 'data-boardid', boardID
|
||||||
|
a.setAttribute 'data-postid', postID
|
||||||
|
|
||||||
unless quoteID in @quotes
|
unless quoteID in @quotes
|
||||||
@quotes.push quoteID
|
@quotes.push quoteID
|
||||||
|
|
||||||
unless a
|
unless a
|
||||||
deadlink.textContent += "\u00A0(Dead)"
|
deadlink.textContent = "#{quote}\u00A0(Dead)"
|
||||||
continue
|
return
|
||||||
|
|
||||||
$.replace deadlink, a
|
$.replace deadlink, a
|
||||||
if $.hasClass a, 'quotelink'
|
if $.hasClass a, 'quotelink'
|
||||||
@nodes.quotelinks.push a
|
@nodes.quotelinks.push a
|
||||||
a = null
|
|
||||||
return
|
|
||||||
|
|
||||||
QuoteInline =
|
QuoteInline =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user