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 Count'] and
!Conf['Unread Favicon'] and !Conf['Unread Favicon'] and
!Conf['Unread Line'] and !Conf['Unread Line'] and
!Conf['Scroll to Last Read Post'] and
!Conf['Thread Watcher'] and
!Conf['Desktop Notifications'] and !Conf['Desktop Notifications'] and
!(Conf['Thread Watcher'] and Conf['Show Unread Count']) !Conf['Quote Threading']
@db = new DataBoard 'lastReadPosts', @sync @db = new DataBoard 'lastReadPosts', @sync
@hr = $.el 'hr', @hr = $.el 'hr',

View File

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