Remove dependence of 'Remember Your Posts' suboptions on 'Quick Reply'. #677
This commit is contained in:
parent
b2db2dc224
commit
a22ca7a3f3
@ -184,10 +184,10 @@ Keybinds =
|
|||||||
return unless thread
|
return unless thread
|
||||||
ThreadHiding.toggle thread if ThreadHiding.db
|
ThreadHiding.toggle thread if ThreadHiding.db
|
||||||
when Conf['Previous Post Quoting You']
|
when Conf['Previous Post Quoting You']
|
||||||
return unless threadRoot and QR.db
|
return unless threadRoot and QuoteYou.db
|
||||||
QuoteYou.cb.seek 'preceding'
|
QuoteYou.cb.seek 'preceding'
|
||||||
when Conf['Next Post Quoting You']
|
when Conf['Next Post Quoting You']
|
||||||
return unless threadRoot and QR.db
|
return unless threadRoot and QuoteYou.db
|
||||||
QuoteYou.cb.seek 'following'
|
QuoteYou.cb.seek 'following'
|
||||||
<% if (tests_enabled) { %>
|
<% if (tests_enabled) { %>
|
||||||
when 't'
|
when 't'
|
||||||
|
|||||||
@ -192,7 +192,7 @@ ThreadWatcher =
|
|||||||
fetchAllStatus: ->
|
fetchAllStatus: ->
|
||||||
ThreadWatcher.db.forceSync()
|
ThreadWatcher.db.forceSync()
|
||||||
ThreadWatcher.unreaddb.forceSync()
|
ThreadWatcher.unreaddb.forceSync()
|
||||||
QR.db?.forceSync()
|
QuoteYou.db?.forceSync()
|
||||||
return unless (threads = ThreadWatcher.getAll()).length
|
return unless (threads = ThreadWatcher.getAll()).length
|
||||||
for thread in threads
|
for thread in threads
|
||||||
ThreadWatcher.fetchStatus thread
|
ThreadWatcher.fetchStatus thread
|
||||||
@ -235,16 +235,16 @@ ThreadWatcher =
|
|||||||
|
|
||||||
for postObj in @response.posts
|
for postObj in @response.posts
|
||||||
continue unless postObj.no > lastReadPost
|
continue unless postObj.no > lastReadPost
|
||||||
continue if QR.db?.get {boardID, threadID, postID: postObj.no}
|
continue if QuoteYou.db?.get {boardID, threadID, postID: postObj.no}
|
||||||
|
|
||||||
unread++
|
unread++
|
||||||
|
|
||||||
continue unless QR.db and postObj.com
|
continue unless QuoteYou.db and postObj.com
|
||||||
|
|
||||||
quotesYou = false
|
quotesYou = false
|
||||||
regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g
|
regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g
|
||||||
while match = regexp.exec postObj.com
|
while match = regexp.exec postObj.com
|
||||||
if QR.db.get {
|
if QuoteYou.db.get {
|
||||||
boardID: match[1] or boardID
|
boardID: match[1] or boardID
|
||||||
threadID: match[2] or threadID
|
threadID: match[2] or threadID
|
||||||
postID: match[3] or match[2] or threadID
|
postID: match[3] or match[2] or threadID
|
||||||
|
|||||||
@ -112,7 +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 QR.db?.get {
|
return if @ID <= Unread.lastReadPost or @isHidden or QuoteYou.db?.get {
|
||||||
boardID: @board.ID
|
boardID: @board.ID
|
||||||
threadID: @thread.ID
|
threadID: @thread.ID
|
||||||
postID: @ID
|
postID: @ID
|
||||||
@ -122,7 +122,7 @@ Unread =
|
|||||||
Unread.position ?= Unread.order[@ID]
|
Unread.position ?= Unread.order[@ID]
|
||||||
|
|
||||||
addPostQuotingYou: (post) ->
|
addPostQuotingYou: (post) ->
|
||||||
for quotelink in post.nodes.quotelinks when QR.db?.get Get.postDataFromLink quotelink
|
for quotelink in post.nodes.quotelinks when QuoteYou.db?.get Get.postDataFromLink quotelink
|
||||||
Unread.postsQuotingYou.add post.ID
|
Unread.postsQuotingYou.add post.ID
|
||||||
Unread.openNotification post
|
Unread.openNotification post
|
||||||
return
|
return
|
||||||
@ -176,7 +176,7 @@ Unread =
|
|||||||
Unread.posts.delete ID
|
Unread.posts.delete ID
|
||||||
Unread.postsQuotingYou.delete ID
|
Unread.postsQuotingYou.delete ID
|
||||||
|
|
||||||
if QR.db?.get {
|
if QuoteYou.db?.get {
|
||||||
boardID: data.board.ID
|
boardID: data.board.ID
|
||||||
threadID: data.thread.ID
|
threadID: data.thread.ID
|
||||||
postID: ID
|
postID: ID
|
||||||
|
|||||||
@ -24,10 +24,6 @@ QR =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless Conf['Quick Reply']
|
return unless Conf['Quick Reply']
|
||||||
|
|
||||||
if Conf['Remember Your Posts']
|
|
||||||
$.sync 'Remember Your Posts', (enabled) -> Conf['Remember Your Posts'] = enabled
|
|
||||||
@db = new DataBoard 'yourPosts'
|
|
||||||
|
|
||||||
@posts = []
|
@posts = []
|
||||||
|
|
||||||
return if g.VIEW is 'archive'
|
return if g.VIEW is 'archive'
|
||||||
@ -769,14 +765,6 @@ QR =
|
|||||||
threadID = +threadID or postID
|
threadID = +threadID or postID
|
||||||
isReply = threadID isnt postID
|
isReply = threadID isnt postID
|
||||||
|
|
||||||
$.forceSync 'Remember Your Posts'
|
|
||||||
if Conf['Remember Your Posts']
|
|
||||||
QR.db?.set
|
|
||||||
boardID: g.BOARD.ID
|
|
||||||
threadID: threadID
|
|
||||||
postID: postID
|
|
||||||
val: true
|
|
||||||
|
|
||||||
# Post/upload confirmed as successful.
|
# Post/upload confirmed as successful.
|
||||||
$.event 'QRPostSuccessful', {
|
$.event 'QRPostSuccessful', {
|
||||||
boardID: g.BOARD.ID
|
boardID: g.BOARD.ID
|
||||||
|
|||||||
@ -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 QR.db?.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
markYours = Conf['Mark Quotes of You'] and QuoteYou.db?.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
||||||
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'
|
||||||
|
|||||||
@ -1,6 +1,14 @@
|
|||||||
QuoteYou =
|
QuoteYou =
|
||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread'] and Conf['Remember Your Posts'] and Conf['Quick Reply']
|
return unless g.VIEW in ['index', 'thread'] and Conf['Remember Your Posts']
|
||||||
|
|
||||||
|
@db = new DataBoard 'yourPosts'
|
||||||
|
$.sync 'Remember Your Posts', (enabled) -> Conf['Remember Your Posts'] = enabled
|
||||||
|
$.on d, 'QRPostSuccessful', (e) ->
|
||||||
|
$.forceSync 'Remember Your Posts'
|
||||||
|
if Conf['Remember Your Posts']
|
||||||
|
{boardID, threadID, postID} = e.detail
|
||||||
|
QuoteYou.db.set {boardID, threadID, postID, val: true}
|
||||||
|
|
||||||
if Conf['Highlight Own Posts']
|
if Conf['Highlight Own Posts']
|
||||||
$.addClass doc, 'highlight-own'
|
$.addClass doc, 'highlight-own'
|
||||||
@ -20,13 +28,13 @@ QuoteYou =
|
|||||||
node: ->
|
node: ->
|
||||||
return if @isClone
|
return if @isClone
|
||||||
|
|
||||||
if QR.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
if QuoteYou.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
|
||||||
$.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.
|
||||||
return unless @quotes.length
|
return unless @quotes.length
|
||||||
|
|
||||||
for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
|
for quotelink in @nodes.quotelinks when QuoteYou.db.get Get.postDataFromLink quotelink
|
||||||
$.add quotelink, $.tn QuoteYou.text if Conf['Mark Quotes of You']
|
$.add quotelink, $.tn QuoteYou.text if Conf['Mark Quotes of You']
|
||||||
$.addClass quotelink, 'you'
|
$.addClass quotelink, 'you'
|
||||||
$.addClass @nodes.root, 'quotesYou'
|
$.addClass @nodes.root, 'quotesYou'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user