Keybind to scroll to posts quoting you.
This commit is contained in:
parent
191dc4911f
commit
6ba8d9ae8c
@ -297,7 +297,9 @@
|
|||||||
'Next reply': ['j', 'Select next reply.'],
|
'Next reply': ['j', 'Select next reply.'],
|
||||||
'Previous reply': ['k', 'Select previous reply.'],
|
'Previous reply': ['k', 'Select previous reply.'],
|
||||||
'Deselect reply': ['Shift+d', 'Deselect reply.'],
|
'Deselect reply': ['Shift+d', 'Deselect reply.'],
|
||||||
'Hide': ['x', 'Hide thread.']
|
'Hide': ['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: {
|
updater: {
|
||||||
checkbox: {
|
checkbox: {
|
||||||
@ -4196,6 +4198,38 @@
|
|||||||
$.addClass(this.nodes.root, 'quotesYou');
|
$.addClass(this.nodes.root, 'quotesYou');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
seek: function(type) {
|
||||||
|
var post, posts, result, str;
|
||||||
|
|
||||||
|
if (!QuoteYou.lastRead) {
|
||||||
|
if (!(post = QuoteYou.lastRead = $('.quotesYou'))) {
|
||||||
|
new Notification('warning', 'No posts are currently quoting you, loser.', 20);
|
||||||
|
}
|
||||||
|
if (QuoteYou.cb.scroll(post)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str = "" + type + "::div[contains(@class,'quotesYou')]";
|
||||||
|
result = $.X(str, QuoteYou.lastRead);
|
||||||
|
while (post = result.snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
|
||||||
|
if (QuoteYou.cb.scroll(post)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
posts = $$('.quotesYou');
|
||||||
|
return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]);
|
||||||
|
},
|
||||||
|
scroll: function(post) {
|
||||||
|
QuoteYou.lastRead = post;
|
||||||
|
if (Get.postFromRoot(post).isHidden) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
Header.scrollToPost(post);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -7971,6 +8005,11 @@
|
|||||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||||
if (bottom < height) {
|
if (bottom < height) {
|
||||||
ID = post.ID;
|
ID = post.ID;
|
||||||
|
if (Conf['Mark Quotes of You']) {
|
||||||
|
if (post.info.yours) {
|
||||||
|
QuoteYou.lastRead = post.nodes.root;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Conf['Quote Threading']) {
|
if (Conf['Quote Threading']) {
|
||||||
posts.splice(i, 1);
|
posts.splice(i, 1);
|
||||||
continue;
|
continue;
|
||||||
@ -9091,6 +9130,12 @@
|
|||||||
ThreadHiding.toggle(thread);
|
ThreadHiding.toggle(thread);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Conf['Previous Post Quoting You']:
|
||||||
|
QuoteYou.cb.seek('preceding');
|
||||||
|
break;
|
||||||
|
case Conf['Next Post Quoting You']:
|
||||||
|
QuoteYou.cb.seek('following');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -278,7 +278,9 @@
|
|||||||
'Next reply': ['j', 'Select next reply.'],
|
'Next reply': ['j', 'Select next reply.'],
|
||||||
'Previous reply': ['k', 'Select previous reply.'],
|
'Previous reply': ['k', 'Select previous reply.'],
|
||||||
'Deselect reply': ['Shift+d', 'Deselect reply.'],
|
'Deselect reply': ['Shift+d', 'Deselect reply.'],
|
||||||
'Hide': ['x', 'Hide thread.']
|
'Hide': ['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: {
|
updater: {
|
||||||
checkbox: {
|
checkbox: {
|
||||||
@ -4201,6 +4203,38 @@
|
|||||||
$.addClass(this.nodes.root, 'quotesYou');
|
$.addClass(this.nodes.root, 'quotesYou');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
seek: function(type) {
|
||||||
|
var post, posts, result, str;
|
||||||
|
|
||||||
|
if (!QuoteYou.lastRead) {
|
||||||
|
if (!(post = QuoteYou.lastRead = $('.quotesYou'))) {
|
||||||
|
new Notification('warning', 'No posts are currently quoting you, loser.', 20);
|
||||||
|
}
|
||||||
|
if (QuoteYou.cb.scroll(post)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str = "" + type + "::div[contains(@class,'quotesYou')]";
|
||||||
|
result = $.X(str, QuoteYou.lastRead);
|
||||||
|
while (post = result.snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
|
||||||
|
if (QuoteYou.cb.scroll(post)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
posts = $$('.quotesYou');
|
||||||
|
return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]);
|
||||||
|
},
|
||||||
|
scroll: function(post) {
|
||||||
|
QuoteYou.lastRead = post;
|
||||||
|
if (Get.postFromRoot(post).isHidden) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
Header.scrollToPost(post);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -7952,6 +7986,11 @@
|
|||||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||||
if (bottom < height) {
|
if (bottom < height) {
|
||||||
ID = post.ID;
|
ID = post.ID;
|
||||||
|
if (Conf['Mark Quotes of You']) {
|
||||||
|
if (post.info.yours) {
|
||||||
|
QuoteYou.lastRead = post.nodes.root;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Conf['Quote Threading']) {
|
if (Conf['Quote Threading']) {
|
||||||
posts.splice(i, 1);
|
posts.splice(i, 1);
|
||||||
continue;
|
continue;
|
||||||
@ -9077,6 +9116,12 @@
|
|||||||
ThreadHiding.toggle(thread);
|
ThreadHiding.toggle(thread);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Conf['Previous Post Quoting You']:
|
||||||
|
QuoteYou.cb.seek('preceding');
|
||||||
|
break;
|
||||||
|
case Conf['Next Post Quoting You']:
|
||||||
|
QuoteYou.cb.seek('following');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -641,6 +641,14 @@ q-replace
|
|||||||
'x'
|
'x'
|
||||||
'Hide thread.'
|
'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:
|
updater:
|
||||||
checkbox:
|
checkbox:
|
||||||
|
|||||||
@ -115,6 +115,10 @@ Keybinds =
|
|||||||
Keybinds.hl 0, threadRoot
|
Keybinds.hl 0, threadRoot
|
||||||
when Conf['Hide']
|
when Conf['Hide']
|
||||||
ThreadHiding.toggle thread if g.VIEW is 'index'
|
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
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@ -126,6 +126,9 @@ Unread =
|
|||||||
{bottom} = post.nodes.root.getBoundingClientRect()
|
{bottom} = post.nodes.root.getBoundingClientRect()
|
||||||
if bottom < height # post is completely read
|
if bottom < height # post is completely read
|
||||||
{ID} = post
|
{ID} = post
|
||||||
|
if Conf['Mark Quotes of You']
|
||||||
|
if post.info.yours
|
||||||
|
QuoteYou.lastRead = post.nodes.root
|
||||||
if Conf['Quote Threading']
|
if Conf['Quote Threading']
|
||||||
posts.splice i, 1
|
posts.splice i, 1
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -14,6 +14,7 @@ QuoteYou =
|
|||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Mark Quotes of You'
|
name: 'Mark Quotes of You'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
# Stop there if it's a clone.
|
# Stop there if it's a clone.
|
||||||
return if @isClone
|
return if @isClone
|
||||||
@ -29,3 +30,27 @@ QuoteYou =
|
|||||||
$.add quotelink, $.tn '\u00A0(You)'
|
$.add quotelink, $.tn '\u00A0(You)'
|
||||||
$.addClass @nodes.root, 'quotesYou'
|
$.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
|
||||||
Loading…
x
Reference in New Issue
Block a user