Keybind to scroll to posts quoting you.

This commit is contained in:
Zixaphir 2013-08-08 23:53:48 -07:00
parent 191dc4911f
commit 6ba8d9ae8c
7 changed files with 137 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -641,6 +641,14 @@ q-replace
'x'
'Hide thread.'
]
'Previous Post Quoting You': [
'Alt+Up'
'Scroll to the previous post that quotes you.'
]
'Next Post Quoting You': [
'Alt+Down'
'Scroll to the next post that quotes you.'
]
updater:
checkbox:

View File

@ -583,8 +583,8 @@ a.hide-announcement {
.qphl {
outline: 2px solid rgba(216, 94, 49, .7);
}
:root.highlight-own .yourPost>.reply,
:root.highlight-you .quotesYou>.reply {
:root.highlight-own .yourPost > .reply,
:root.highlight-you .quotesYou > .reply {
border-left: 2px solid rgba(221,0,0,.5);
}
/* Quote Threading */

View File

@ -115,6 +115,10 @@ Keybinds =
Keybinds.hl 0, threadRoot
when Conf['Hide']
ThreadHiding.toggle thread if g.VIEW is 'index'
when Conf['Previous Post Quoting You']
QuoteYou.cb.seek 'preceding'
when Conf['Next Post Quoting You']
QuoteYou.cb.seek 'following'
else
return
e.preventDefault()

View File

@ -126,6 +126,9 @@ Unread =
{bottom} = post.nodes.root.getBoundingClientRect()
if bottom < height # post is completely read
{ID} = post
if Conf['Mark Quotes of You']
if post.info.yours
QuoteYou.lastRead = post.nodes.root
if Conf['Quote Threading']
posts.splice i, 1
continue

View File

@ -14,6 +14,7 @@ QuoteYou =
Post::callbacks.push
name: 'Mark Quotes of You'
cb: @node
node: ->
# Stop there if it's a clone.
return if @isClone
@ -28,4 +29,28 @@ QuoteYou =
if QR.db.get Get.postDataFromLink quotelink
$.add quotelink, $.tn '\u00A0(You)'
$.addClass @nodes.root, 'quotesYou'
return
return
cb:
seek: (type) ->
unless QuoteYou.lastRead
unless post = QuoteYou.lastRead = $ '.quotesYou'
new Notification 'warning', 'No posts are currently quoting you, loser.', 20
return if QuoteYou.cb.scroll post
str = "#{type}::div[contains(@class,'quotesYou')]"
result = $.X(str, QuoteYou.lastRead)
while post = result.snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0)
return if QuoteYou.cb.scroll post
posts = $$ '.quotesYou'
QuoteYou.cb.scroll posts[if type is 'following' then 0 else posts.length - 1]
scroll: (post) ->
QuoteYou.lastRead = post
if Get.postFromRoot(post).isHidden
return false
else
Header.scrollToPost post
return true