Merge branch 'v3'

Conflicts:
	LICENSE
	builds/crx/script.js
	src/Quotelinks/QuoteYou.coffee
This commit is contained in:
Zixaphir 2013-08-09 01:10:31 -07:00
commit da2a99c0ca
4 changed files with 39 additions and 14 deletions

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.2.25 - 2013-08-08 * 4chan X - Version 1.2.25 - 2013-08-09
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4161,7 +4161,7 @@
QuoteYou = { QuoteYou = {
init: function() { init: function() {
if (g.VIEW === 'catalog' || !Conf['Mark Quotes of You'] || !Conf['Quick Reply']) { if (!(g.VIEW !== 'catalog' && Conf['Mark Quotes of You'] && Conf['Quick Reply'])) {
return; return;
} }
if (Conf['Highlight Own Posts']) { if (Conf['Highlight Own Posts']) {
@ -4203,17 +4203,21 @@
seek: function(type) { seek: function(type) {
var post, posts, result, str; var post, posts, result, str;
return unlses(Conf['Mark Quotes of You'] && Conf['Quick Reply']);
$.rmClass($('.highlight'), 'highlight');
if (!QuoteYou.lastRead) { if (!QuoteYou.lastRead) {
if (!(post = QuoteYou.lastRead = $('.quotesYou'))) { if (!(post = QuoteYou.lastRead = $('.quotesYou'))) {
new Notification('warning', 'No posts are currently quoting you, loser.', 20); new Notification('warning', 'No posts are currently quoting you, loser.', 20);
return;
} }
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
} else {
post = QuoteYou.lastRead;
} }
str = "" + type + "::div[contains(@class,'quotesYou')]"; str = "" + type + "::div[contains(@class,'quotesYou')]";
result = $.X(str, QuoteYou.lastRead); while (post = (result = $.X(str, post)).snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
while (post = result.snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
@ -4222,11 +4226,13 @@
return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]); return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]);
}, },
scroll: function(post) { scroll: function(post) {
QuoteYou.lastRead = post;
if (Get.postFromRoot(post).isHidden) { if (Get.postFromRoot(post).isHidden) {
return false; return false;
} else { } else {
QuoteYou.lastRead = post;
window.location = "#" + post.id;
Header.scrollToPost(post); Header.scrollToPost(post);
$.addClass($('.post', post), 'highlight');
return true; return true;
} }
} }

View File

@ -6503,17 +6503,21 @@
seek: function(type) { seek: function(type) {
var post, posts, result, str; var post, posts, result, str;
return unlses(Conf['Mark Quotes of You'] && Conf['Quick Reply']);
$.rmClass($('.highlight'), 'highlight');
if (!QuoteYou.lastRead) { if (!QuoteYou.lastRead) {
if (!(post = QuoteYou.lastRead = $('.quotesYou'))) { if (!(post = QuoteYou.lastRead = $('.quotesYou'))) {
new Notification('warning', 'No posts are currently quoting you, loser.', 20); new Notification('warning', 'No posts are currently quoting you, loser.', 20);
return;
} }
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
} else {
post = QuoteYou.lastRead;
} }
str = "" + type + "::div[contains(@class,'quotesYou')]"; str = "" + type + "::div[contains(@class,'quotesYou')]";
result = $.X(str, QuoteYou.lastRead); while (post = (result = $.X(str, post)).snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
while (post = result.snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
@ -6522,11 +6526,13 @@
return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]); return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]);
}, },
scroll: function(post) { scroll: function(post) {
QuoteYou.lastRead = post;
if (Get.postFromRoot(post).isHidden) { if (Get.postFromRoot(post).isHidden) {
return false; return false;
} else { } else {
QuoteYou.lastRead = post;
window.location = "#" + post.id;
Header.scrollToPost(post); Header.scrollToPost(post);
$.addClass($('.post', post), 'highlight');
return true; return true;
} }
} }

View File

@ -6510,17 +6510,21 @@
seek: function(type) { seek: function(type) {
var post, posts, result, str; var post, posts, result, str;
return unlses(Conf['Mark Quotes of You'] && Conf['Quick Reply']);
$.rmClass($('.highlight'), 'highlight');
if (!QuoteYou.lastRead) { if (!QuoteYou.lastRead) {
if (!(post = QuoteYou.lastRead = $('.quotesYou'))) { if (!(post = QuoteYou.lastRead = $('.quotesYou'))) {
new Notification('warning', 'No posts are currently quoting you, loser.', 20); new Notification('warning', 'No posts are currently quoting you, loser.', 20);
return;
} }
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
} else {
post = QuoteYou.lastRead;
} }
str = "" + type + "::div[contains(@class,'quotesYou')]"; str = "" + type + "::div[contains(@class,'quotesYou')]";
result = $.X(str, QuoteYou.lastRead); while (post = (result = $.X(str, post)).snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
while (post = result.snapshotItem(type === 'preceding' ? result.snapshotLength - 1 : 0)) {
if (QuoteYou.cb.scroll(post)) { if (QuoteYou.cb.scroll(post)) {
return; return;
} }
@ -6529,11 +6533,13 @@
return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]); return QuoteYou.cb.scroll(posts[type === 'following' ? 0 : posts.length - 1]);
}, },
scroll: function(post) { scroll: function(post) {
QuoteYou.lastRead = post;
if (Get.postFromRoot(post).isHidden) { if (Get.postFromRoot(post).isHidden) {
return false; return false;
} else { } else {
QuoteYou.lastRead = post;
window.location = "#" + post.id;
Header.scrollToPost(post); Header.scrollToPost(post);
$.addClass($('.post', post), 'highlight');
return true; return true;
} }
} }

View File

@ -33,24 +33,31 @@ QuoteYou =
cb: cb:
seek: (type) -> seek: (type) ->
return unlses Conf['Mark Quotes of You'] and Conf['Quick Reply']
$.rmClass $('.highlight'), 'highlight'
unless QuoteYou.lastRead unless QuoteYou.lastRead
unless post = QuoteYou.lastRead = $ '.quotesYou' unless post = QuoteYou.lastRead = $ '.quotesYou'
new Notification 'warning', 'No posts are currently quoting you, loser.', 20 new Notification 'warning', 'No posts are currently quoting you, loser.', 20
return
return if QuoteYou.cb.scroll post return if QuoteYou.cb.scroll post
else
post = QuoteYou.lastRead
str = "#{type}::div[contains(@class,'quotesYou')]" str = "#{type}::div[contains(@class,'quotesYou')]"
result = $.X(str, QuoteYou.lastRead) while post = (result = $.X(str, post)).snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0)
while post = result.snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0)
return if QuoteYou.cb.scroll post return if QuoteYou.cb.scroll post
posts = $$ '.quotesYou' posts = $$ '.quotesYou'
QuoteYou.cb.scroll posts[if type is 'following' then 0 else posts.length - 1] QuoteYou.cb.scroll posts[if type is 'following' then 0 else posts.length - 1]
scroll: (post) -> scroll: (post) ->
QuoteYou.lastRead = post
if Get.postFromRoot(post).isHidden if Get.postFromRoot(post).isHidden
return false return false
else else
QuoteYou.lastRead = post
window.location = "##{post.id}"
Header.scrollToPost post Header.scrollToPost post
$.addClass $('.post', post), 'highlight'
return true return true