Highlight posts that quote you when scrolling to them
update window.location because lolwhynot
This commit is contained in:
parent
00fc8013bf
commit
c438ab6c3b
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
|||||||
@ -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
|
||||||
@ -4206,14 +4206,17 @@
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
$.rmClass($('.highlight'), 'highlight');
|
||||||
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 +4225,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
@ -4211,14 +4211,17 @@
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
$.rmClass($('.highlight'), 'highlight');
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -4227,11 +4230,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,21 +36,27 @@ QuoteYou =
|
|||||||
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
|
||||||
|
|
||||||
|
$.rmClass $('.highlight'), 'highlight'
|
||||||
|
|
||||||
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
|
||||||
Loading…
x
Reference in New Issue
Block a user