Fix dead quotelinks inside clones.

This commit is contained in:
Nicolas Stepien 2013-04-15 18:34:17 +02:00
parent abaf10e101
commit 6a8ebfed0d
3 changed files with 56 additions and 53 deletions

View File

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

View File

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

View File

@ -2606,24 +2606,29 @@ 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 @isClone
if $.hasClass deadlink, 'quotelink'
@nodes.quotelinks.push deadlink
else
Quotify.parseDeadlink.call @, deadlink
return
parseDeadlink: (deadlink) ->
if deadlink.parentNode.className is 'prettyprint' if deadlink.parentNode.className is 'prettyprint'
# Don't quotify deadlinks inside code tags, # Don't quotify deadlinks inside code tags,
# un-`span` them. # un-`span` them.
$.replace deadlink, [deadlink.childNodes...] $.replace deadlink, [deadlink.childNodes...]
continue return
quote = deadlink.textContent quote = deadlink.textContent
continue unless postID = quote.match(/\d+$/)?[0] return unless postID = quote.match(/\d+$/)?[0]
boardID = boardID = if m = quote.match /^>>>\/([a-z\d]+)/
if m = quote.match /^>>>\/([a-z\d]+)/
m[1] m[1]
else else
@board.ID @board.ID
quoteID = "#{boardID}.#{postID}" quoteID = "#{boardID}.#{postID}"
# \u00A0 is nbsp
if post = g.posts[quoteID] if post = g.posts[quoteID]
unless post.isDead unless post.isDead
# Don't (Dead) when quotifying in an archived post, # Don't (Dead) when quotifying in an archived post,
@ -2659,14 +2664,12 @@ Quotify =
@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: ->