From db46cf64b2e5506a06a02b277107a2680a1b8df0 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 13 Dec 2015 12:12:26 -0800 Subject: [PATCH] Fix errors when post quoting you is added then removed from document. Also parenthesize some assignments in if/while expressions. --- src/Quotelinks/QuoteYou.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee index d127f45dc..27284fc9c 100644 --- a/src/Quotelinks/QuoteYou.coffee +++ b/src/Quotelinks/QuoteYou.coffee @@ -36,8 +36,8 @@ QuoteYou = seek: (type) -> $.rmClass highlight, 'highlight' if highlight = $ '.highlight' - unless QuoteYou.lastRead - unless post = QuoteYou.lastRead = $ '.quotesYou' + unless QuoteYou.lastRead and doc.contains(QuoteYou.lastRead) and $.hasClass(QuoteYou.lastRead, 'quotesYou') + unless (post = QuoteYou.lastRead = $ '.quotesYou') new Notice 'warning', 'No posts are currently quoting you, loser.', 20 return return if QuoteYou.cb.scroll post @@ -46,7 +46,7 @@ QuoteYou = str = "#{type}::div[contains(@class,'quotesYou')]" - while post = (result = $.X(str, post)).snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0) + while (post = (result = $.X(str, post)).snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0)) return if QuoteYou.cb.scroll post posts = $$ '.quotesYou'