Merge branch 'v3'

Conflicts:
	builds/crx/script.js
This commit is contained in:
Zixaphir 2013-08-08 23:56:30 -07:00
commit dbc8e21297
10 changed files with 187 additions and 11 deletions

View File

@ -16,6 +16,7 @@
- Linkifier Rewrite.
- Fix Quote Threading toggle.
- Added Twitch.tv and Vine embedding (with @ihavenoface)
- Keybinds to scroll to posts that quote you.
- Minor optimizations.
- Minor fixes.

File diff suppressed because one or more lines are too long

View File

@ -389,7 +389,9 @@
'Next reply': ['j', 'Select next reply.'],
'Previous reply': ['k', 'Select previous 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: {
checkbox: {
@ -6496,6 +6498,38 @@
$.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;
}
}
}
};
@ -10303,6 +10337,11 @@
bottom = post.nodes.root.getBoundingClientRect().bottom;
if (bottom < height) {
ID = post.ID;
if (Conf['Mark Quotes of You']) {
if (post.info.yours) {
QuoteYou.lastRead = post.nodes.root;
}
}
if (Conf['Quote Threading']) {
posts.splice(i, 1);
continue;
@ -12923,6 +12962,12 @@
ThreadHiding.toggle(thread);
}
break;
case Conf['Previous Post Quoting You']:
QuoteYou.cb.seek('preceding');
break;
case Conf['Next Post Quoting You']:
QuoteYou.cb.seek('following');
break;
default:
return;
}
@ -14679,7 +14724,7 @@
$.ready(function() {
var URL;
if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') {
if (Conf['404 Redirect'] && ['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains(d.title)) {
Redirect.init();
pathname = location.pathname.split('/');
URL = Redirect.to('file', {

View File

@ -372,7 +372,9 @@
'Next reply': ['j', 'Select next reply.'],
'Previous reply': ['k', 'Select previous 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: {
checkbox: {
@ -6503,6 +6505,38 @@
$.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;
}
}
}
};
@ -10286,6 +10320,11 @@
bottom = post.nodes.root.getBoundingClientRect().bottom;
if (bottom < height) {
ID = post.ID;
if (Conf['Mark Quotes of You']) {
if (post.info.yours) {
QuoteYou.lastRead = post.nodes.root;
}
}
if (Conf['Quote Threading']) {
posts.splice(i, 1);
continue;
@ -12911,6 +12950,12 @@
ThreadHiding.toggle(thread);
}
break;
case Conf['Previous Post Quoting You']:
QuoteYou.cb.seek('preceding');
break;
case Conf['Next Post Quoting You']:
QuoteYou.cb.seek('following');
break;
default:
return;
}
@ -14659,7 +14704,7 @@
$.ready(function() {
var URL;
if (Conf['404 Redirect'] && d.title === '4chan - 404 Not Found') {
if (Conf['404 Redirect'] && ['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains(d.title)) {
Redirect.init();
pathname = location.pathname.split('/');
URL = Redirect.to('file', {

View File

@ -993,6 +993,14 @@ box-shadow: inset 2px 2px 2px rgba(0,0,0,0.2);
'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

@ -80,7 +80,7 @@ Main =
return
when 'images.4chan.org'
$.ready ->
if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found'
if Conf['404 Redirect'] and ['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains d.title
Redirect.init()
pathname = location.pathname.split '/'
URL = Redirect.to 'file',

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

@ -113,6 +113,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
do 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