diff --git a/CHANGELOG.md b/CHANGELOG.md index a7acabc21..4b9aeb50c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - 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. ### 3.0.6 - *2013-04-14* diff --git a/lib/ui.coffee b/lib/ui.coffee index eb06129aa..a743993de 100644 --- a/lib/ui.coffee +++ b/lib/ui.coffee @@ -6,8 +6,7 @@ UI = do -> id: id $.get "#{id}.position", position, (item) -> el.style.cssText = item["#{id}.position"] - move = $ '.move', el - $.on move, 'touchstart mousedown', dragstart + $.on $('.move', el), 'touchstart mousedown', dragstart el diff --git a/src/features.coffee b/src/features.coffee index 16aaa8b60..412eef272 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -2606,67 +2606,70 @@ Quotify = name: 'Resurrect Quotes' cb: @node node: -> - return if @isClone for deadlink in $$ '.deadlink', @nodes.comment - if deadlink.parentNode.className is 'prettyprint' - # Don't quotify deadlinks inside code tags, - # un-`span` them. - $.replace deadlink, [deadlink.childNodes...] - continue + if @isClone + if $.hasClass deadlink, 'quotelink' + @nodes.quotelinks.push deadlink + else + Quotify.parseDeadlink.call @, deadlink + return - quote = deadlink.textContent - continue unless postID = quote.match(/\d+$/)?[0] - boardID = - if m = quote.match /^>>>\/([a-z\d]+)/ - m[1] - else - @board.ID - quoteID = "#{boardID}.#{postID}" + parseDeadlink: (deadlink) -> + if deadlink.parentNode.className is 'prettyprint' + # Don't quotify deadlinks inside code tags, + # un-`span` them. + $.replace deadlink, [deadlink.childNodes...] + return - # \u00A0 is nbsp - if post = g.posts[quoteID] - unless post.isDead - # Don't (Dead) when quotifying in an archived post, - # and we know the post still exists. - a = $.el 'a', - href: "/#{boardID}/#{post.thread}/res/#p#{postID}" - className: 'quotelink' - textContent: quote - else - # Replace the .deadlink span if we can redirect. - a = $.el 'a', - href: "/#{boardID}/#{post.thread}/res/#p#{postID}" - className: 'quotelink deadlink' - target: '_blank' - textContent: "#{quote}\u00A0(Dead)" - a.setAttribute 'data-boardid', boardID - a.setAttribute 'data-threadid', post.thread.ID - a.setAttribute 'data-postid', postID - else if redirect = Redirect.to {boardID, threadID: 0, postID} + quote = deadlink.textContent + return unless postID = quote.match(/\d+$/)?[0] + boardID = if m = quote.match /^>>>\/([a-z\d]+)/ + m[1] + else + @board.ID + quoteID = "#{boardID}.#{postID}" + + if post = g.posts[quoteID] + unless post.isDead + # Don't (Dead) when quotifying in an archived post, + # and we know the post still exists. + a = $.el 'a', + href: "/#{boardID}/#{post.thread}/res/#p#{postID}" + className: 'quotelink' + textContent: quote + else # Replace the .deadlink span if we can redirect. a = $.el 'a', - href: redirect - className: 'deadlink' + href: "/#{boardID}/#{post.thread}/res/#p#{postID}" + className: 'quotelink 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 + a.setAttribute 'data-boardid', boardID + 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. + 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 - @quotes.push quoteID + unless quoteID in @quotes + @quotes.push quoteID - unless a - deadlink.textContent += "\u00A0(Dead)" - continue + unless a + deadlink.textContent = "#{quote}\u00A0(Dead)" + return - $.replace deadlink, a - if $.hasClass a, 'quotelink' - @nodes.quotelinks.push a - a = null - return + $.replace deadlink, a + if $.hasClass a, 'quotelink' + @nodes.quotelinks.push a QuoteInline = init: ->