Fix errors when post quoting you is added then removed from document.

Also parenthesize some assignments in if/while expressions.
This commit is contained in:
ccd0 2015-12-13 12:12:26 -08:00
parent 939638b480
commit db46cf64b2

View File

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