Add convenience function QuoteYou.isYou.
This commit is contained in:
parent
3b61cbc21f
commit
192eafa670
@ -112,11 +112,7 @@ Unread =
|
|||||||
addPost: ->
|
addPost: ->
|
||||||
return if @isFetchedQuote or @isClone
|
return if @isFetchedQuote or @isClone
|
||||||
Unread.order.push @
|
Unread.order.push @
|
||||||
return if @ID <= Unread.lastReadPost or @isHidden or QuoteYou.db?.get {
|
return if @ID <= Unread.lastReadPost or @isHidden or QuoteYou.isYou(@)
|
||||||
boardID: @board.ID
|
|
||||||
threadID: @thread.ID
|
|
||||||
postID: @ID
|
|
||||||
}
|
|
||||||
Unread.posts.add @ID
|
Unread.posts.add @ID
|
||||||
Unread.addPostQuotingYou @
|
Unread.addPostQuotingYou @
|
||||||
Unread.position ?= Unread.order[@ID]
|
Unread.position ?= Unread.order[@ID]
|
||||||
@ -172,11 +168,7 @@ Unread =
|
|||||||
Unread.posts.delete ID
|
Unread.posts.delete ID
|
||||||
Unread.postsQuotingYou.delete ID
|
Unread.postsQuotingYou.delete ID
|
||||||
|
|
||||||
if QuoteYou.db?.get {
|
if QuoteYou.isYou data
|
||||||
boardID: data.board.ID
|
|
||||||
threadID: data.thread.ID
|
|
||||||
postID: ID
|
|
||||||
}
|
|
||||||
QuoteYou.lastRead = root
|
QuoteYou.lastRead = root
|
||||||
Unread.position = Unread.position.next
|
Unread.position = Unread.position.next
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ QuoteBacklink =
|
|||||||
cb: @secondNode
|
cb: @secondNode
|
||||||
firstNode: ->
|
firstNode: ->
|
||||||
return if @isClone or !@quotes.length or @isRebuilt
|
return if @isClone or !@quotes.length or @isRebuilt
|
||||||
markYours = Conf['Mark Quotes of You'] and QuoteYou.db?.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
markYours = Conf['Mark Quotes of You'] and QuoteYou.isYou(@)
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
href: Build.postURL @board.ID, @thread.ID, @ID
|
href: Build.postURL @board.ID, @thread.ID, @ID
|
||||||
className: if @isHidden then 'filtered backlink' else 'backlink'
|
className: if @isHidden then 'filtered backlink' else 'backlink'
|
||||||
|
|||||||
@ -31,10 +31,17 @@ QuoteYou =
|
|||||||
|
|
||||||
QuoteYou.menu.init()
|
QuoteYou.menu.init()
|
||||||
|
|
||||||
|
isYou: (post) ->
|
||||||
|
!!QuoteYou.db?.get {
|
||||||
|
boardID: post.board.ID
|
||||||
|
threadID: post.thread.ID
|
||||||
|
postID: post.ID
|
||||||
|
}
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return if @isClone
|
return if @isClone
|
||||||
|
|
||||||
if QuoteYou.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
if QuoteYou.isYou @
|
||||||
$.addClass @nodes.root, 'yourPost'
|
$.addClass @nodes.root, 'yourPost'
|
||||||
|
|
||||||
# Stop there if there's no quotes in that post.
|
# Stop there if there's no quotes in that post.
|
||||||
@ -57,7 +64,7 @@ QuoteYou =
|
|||||||
order: 12
|
order: 12
|
||||||
open: (post) ->
|
open: (post) ->
|
||||||
QuoteYou.menu.post = (post.origin or post)
|
QuoteYou.menu.post = (post.origin or post)
|
||||||
input.checked = QuoteYou.db.get {boardID: post.board.ID, threadID: post.thread.ID, postID: post.ID}
|
input.checked = QuoteYou.isYou post
|
||||||
true
|
true
|
||||||
|
|
||||||
toggle: ->
|
toggle: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user