diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 978bac3ed..b9fb24df1 100755 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -26,8 +26,10 @@ QuoteInline = return qiQuote: (link, hidden) -> + name = "hashlink" + name += " filtered" if hidden $.el 'a', - className: "hashlink#{if hidden then ' filtered' else ''}" + className: name textContent: '#' href: link.href @@ -39,7 +41,7 @@ QuoteInline = if $.hasClass @, 'inlined' QuoteInline.rm @, boardID, threadID, postID, context else - return if $.x "ancestor::div[@id='p#{postID}']", @ + return if $.x "ancestor::div[@id='pc#{postID}']", @ QuoteInline.add @, boardID, threadID, postID, context @classList.toggle 'inlined' diff --git a/src/Quotelinks/QuotePreview.coffee b/src/Quotelinks/QuotePreview.coffee index 428d18a92..7d82087ff 100755 --- a/src/Quotelinks/QuotePreview.coffee +++ b/src/Quotelinks/QuotePreview.coffee @@ -1,6 +1,6 @@ QuotePreview = init: -> - return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Previewing'] + return unless g.VIEW in ['index', 'thread'] and Conf['Quote Previewing'] if Conf['Comment Expansion'] ExpandComment.callbacks.push @node diff --git a/src/Quotelinks/QuoteStrikeThrough.coffee b/src/Quotelinks/QuoteStrikeThrough.coffee index 0444f326c..fee420919 100755 --- a/src/Quotelinks/QuoteStrikeThrough.coffee +++ b/src/Quotelinks/QuoteStrikeThrough.coffee @@ -1,6 +1,7 @@ QuoteStrikeThrough = init: -> - return if g.VIEW not in ['index', 'thread'] or !Conf['Reply Hiding Buttons'] and !(Conf['Menu'] and Conf['Reply Hiding Link']) and !Conf['Filter'] + return unless g.VIEW in ['index', 'thread'] and + (Conf['Reply Hiding Buttons'] or (Conf['Menu'] and Conf['Reply Hiding Link']) or Conf['Filter']) Post.callbacks.push name: 'Strike-through Quotes' diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 3a897f3a5..a4f874589 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -15,11 +15,10 @@ QuoteThreading = hidden: true $.extend @threadNewLink, <%= html('Thread New Posts') %> - $.on $('input', @controls), 'change', -> - QuoteThreading.rethread @checked - $.on @threadNewLink.firstElementChild, 'click', -> - QuoteThreading.threadNewLink.hidden = true - QuoteThreading.rethread true + @input = $('input', @controls) + + $.on @input, 'change', @cb.thread + $.on @threadNewLink.firstElementChild, 'click', @cb.click Header.menu.addEntry @entry = el: @controls @@ -45,10 +44,10 @@ QuoteThreading = node: -> return if @isFetchedQuote or @isClone or !@isReply {thread} = QuoteThreading - parents = for quote in @quotes - parent = g.posts[quote] - continue if !parent or parent.isFetchedQuote or !parent.isReply or parent.ID >= @ID - parent + parents = (parent for quote in @quotes when (parent = g.posts[quote]) and + not parent.isFetchedQuote and parent.isReply and parent.ID < @ID + ) + if parents.length is 1 QuoteThreading.parent[@fullID] = parents[0] @@ -65,9 +64,10 @@ QuoteThreading = !QuoteThreading.inserted[post.fullID] descendants = QuoteThreading.descendants post - if !Unread.posts.has(parent.ID) and descendants.some((x) -> Unread.posts.has(x.ID)) - QuoteThreading.threadNewLink.hidden = false - return false + if !Unread.posts.has(parent.ID) + if (do -> return true for x in descendants when Unread.posts.has x.ID) + QuoteThreading.threadNewLink.hidden = false + return false {order} = Unread children = (QuoteThreading.children[parent.fullID] or= []) @@ -107,7 +107,7 @@ QuoteThreading = posts.forEach QuoteThreading.insert else nodes = [] - Unread.order = new RandomAccessList + Unread.order = new RandomAccessList() QuoteThreading.inserted = {} posts.forEach (post) -> return if post.isFetchedQuote @@ -125,3 +125,9 @@ QuoteThreading = Unread.setLine true Unread.read() Unread.update() + + cb: + thread: -> QuoteThreading.rethread QuoteThreading.input.checked + click: -> + QuoteThreading.threadNewLink.hidden = true + QuoteThreading.rethread true diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 977c9f55c..ff4be4a31 100755 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -74,7 +74,9 @@ Quotify = @quotes.push quoteID unless quoteID in @quotes - return deadlink.textContent = "#{quote}\u00A0(Dead)" unless a + unless a + deadlink.textContent = "#{quote}\u00A0(Dead)" + return $.replace deadlink, a if $.hasClass a, 'quotelink'