Fix Unread.init condition.

This commit is contained in:
ccd0 2014-11-22 15:39:50 -08:00
parent 1296959876
commit e74cd4e961
2 changed files with 8 additions and 10 deletions

View File

@ -4,8 +4,10 @@ Unread =
!Conf['Unread Count'] and
!Conf['Unread Favicon'] and
!Conf['Unread Line'] and
!Conf['Scroll to Last Read Post'] and
!Conf['Thread Watcher'] and
!Conf['Desktop Notifications'] and
!(Conf['Thread Watcher'] and Conf['Show Unread Count'])
!Conf['Quote Threading']
@db = new DataBoard 'lastReadPosts', @sync
@hr = $.el 'hr',

View File

@ -17,7 +17,7 @@ QuoteThreading =
el: @controls
order: 98
$.on d, '4chanXInitFinished', @ready unless Conf['Unread Count']
$.on d, '4chanXInitFinished', @ready
Post.callbacks.push
name: 'Quote Threading'
@ -30,16 +30,14 @@ QuoteThreading =
force: ->
g.posts.forEach (post) ->
post.cb true if post.cb
if Conf['Unread Count'] and Unread.thread.OP.nodes.root.parentElement.parentElement
Unread.read()
Unread.update()
Unread.read()
Unread.update()
node: ->
{posts} = g
return if @isClone or not QuoteThreading.enabled
Unread.addPost @ if Conf['Unread Count']
Unread.addPost @
return if @thread.OP is @ or @isHidden # Filtered
keys = []
@ -64,7 +62,7 @@ QuoteThreading =
{bottom, top} = root.getBoundingClientRect()
# Post is unread or is fully visible.
return false unless (Conf['Unread Count'] and posts[post.ID]) or ((bottom < height) and (top > 0))
return false unless posts[post.ID] or ((bottom < height) and (top > 0))
if $.hasClass root, 'threadOP'
threadContainer = root.nextElementSibling
@ -78,8 +76,6 @@ QuoteThreading =
$.after root, threadContainer
$.addClass root, 'threadOP'
return true unless Conf['Unread Count']
if post = posts[post.ID]
posts.after post, posts[@ID]