Restore Scroll To Post Quoting You functionality.
This commit is contained in:
parent
e20a822481
commit
148edd3e33
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.4.1 - 2014-03-23
|
* 4chan X - Version 1.4.1 - 2014-03-24
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.4.1 - 2014-03-23
|
* 4chan X - Version 1.4.1 - 2014-03-24
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
@ -5501,6 +5501,50 @@
|
|||||||
} else if (mayReset) {
|
} else if (mayReset) {
|
||||||
return quotelink.textContent = text;
|
return quotelink.textContent = text;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
seek: function(type) {
|
||||||
|
var post;
|
||||||
|
if (Conf['Mark Quotes of You'] && (post = QuotesYou.cb.findPost(type))) {
|
||||||
|
return Quotesyou.cb.scroll(post);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
findPost: function(type) {
|
||||||
|
var i, index, len, post, posts;
|
||||||
|
posts = $$('.quotesYou');
|
||||||
|
if (!QuoteMarkers.lastRead) {
|
||||||
|
if (!(post = QuoteMarkers.lastRead = posts[0])) {
|
||||||
|
new Notice('warning', 'No posts are currently quoting you, loser.', 20);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Get.postFromRoot(post).isHidden) {
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
post = QuoteMarkers.lastRead;
|
||||||
|
}
|
||||||
|
len = posts.length - 1;
|
||||||
|
index = i = posts.indexOf(post);
|
||||||
|
while (true) {
|
||||||
|
if (index === (i = i === 0 ? len : i === len ? 0 : type === 'prev' ? i - 1 : i + 1)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
post = posts[i];
|
||||||
|
if (!Get.postFromRoot(post).isHidden) {
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scroll: function(post) {
|
||||||
|
var highlight;
|
||||||
|
if (highlight = $('.highlight')) {
|
||||||
|
$.rmClass(highlight, 'highlight');
|
||||||
|
}
|
||||||
|
QuoteMarkers.lastRead = post;
|
||||||
|
window.location.hash = "#" + post.id;
|
||||||
|
Header.scrollTo(post);
|
||||||
|
return $.addClass($('.post', post), 'highlight');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -11962,10 +12006,10 @@
|
|||||||
PostHiding.toggle(thread.OP);
|
PostHiding.toggle(thread.OP);
|
||||||
break;
|
break;
|
||||||
case Conf['Previous Post Quoting You']:
|
case Conf['Previous Post Quoting You']:
|
||||||
QuoteYou.cb.seek('preceding');
|
QuoteMarkers.cb.seek('preceding');
|
||||||
break;
|
break;
|
||||||
case Conf['Next Post Quoting You']:
|
case Conf['Next Post Quoting You']:
|
||||||
QuoteYou.cb.seek('following');
|
QuoteMarkers.cb.seek('following');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.4.1 - 2014-03-23
|
* 4chan X - Version 1.4.1 - 2014-03-24
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
@ -5555,6 +5555,50 @@
|
|||||||
} else if (mayReset) {
|
} else if (mayReset) {
|
||||||
return quotelink.textContent = text;
|
return quotelink.textContent = text;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
seek: function(type) {
|
||||||
|
var post;
|
||||||
|
if (Conf['Mark Quotes of You'] && (post = QuotesYou.cb.findPost(type))) {
|
||||||
|
return Quotesyou.cb.scroll(post);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
findPost: function(type) {
|
||||||
|
var i, index, len, post, posts;
|
||||||
|
posts = $$('.quotesYou');
|
||||||
|
if (!QuoteMarkers.lastRead) {
|
||||||
|
if (!(post = QuoteMarkers.lastRead = posts[0])) {
|
||||||
|
new Notice('warning', 'No posts are currently quoting you, loser.', 20);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Get.postFromRoot(post).isHidden) {
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
post = QuoteMarkers.lastRead;
|
||||||
|
}
|
||||||
|
len = posts.length - 1;
|
||||||
|
index = i = posts.indexOf(post);
|
||||||
|
while (true) {
|
||||||
|
if (index === (i = i === 0 ? len : i === len ? 0 : type === 'prev' ? i - 1 : i + 1)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
post = posts[i];
|
||||||
|
if (!Get.postFromRoot(post).isHidden) {
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scroll: function(post) {
|
||||||
|
var highlight;
|
||||||
|
if (highlight = $('.highlight')) {
|
||||||
|
$.rmClass(highlight, 'highlight');
|
||||||
|
}
|
||||||
|
QuoteMarkers.lastRead = post;
|
||||||
|
window.location.hash = "#" + post.id;
|
||||||
|
Header.scrollTo(post);
|
||||||
|
return $.addClass($('.post', post), 'highlight');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -11978,10 +12022,10 @@
|
|||||||
PostHiding.toggle(thread.OP);
|
PostHiding.toggle(thread.OP);
|
||||||
break;
|
break;
|
||||||
case Conf['Previous Post Quoting You']:
|
case Conf['Previous Post Quoting You']:
|
||||||
QuoteYou.cb.seek('preceding');
|
QuoteMarkers.cb.seek('preceding');
|
||||||
break;
|
break;
|
||||||
case Conf['Next Post Quoting You']:
|
case Conf['Next Post Quoting You']:
|
||||||
QuoteYou.cb.seek('following');
|
QuoteMarkers.cb.seek('following');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -135,9 +135,9 @@ Keybinds =
|
|||||||
when Conf['Hide']
|
when Conf['Hide']
|
||||||
PostHiding.toggle thread.OP
|
PostHiding.toggle thread.OP
|
||||||
when Conf['Previous Post Quoting You']
|
when Conf['Previous Post Quoting You']
|
||||||
QuoteYou.cb.seek 'preceding'
|
QuoteMarkers.cb.seek 'preceding'
|
||||||
when Conf['Next Post Quoting You']
|
when Conf['Next Post Quoting You']
|
||||||
QuoteYou.cb.seek 'following'
|
QuoteMarkers.cb.seek 'following'
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@ -45,3 +45,43 @@ QuoteMarkers =
|
|||||||
quotelink.textContent = "#{text}\u00A0(#{markers.join '|'})"
|
quotelink.textContent = "#{text}\u00A0(#{markers.join '|'})"
|
||||||
else if mayReset
|
else if mayReset
|
||||||
quotelink.textContent = text
|
quotelink.textContent = text
|
||||||
|
|
||||||
|
cb:
|
||||||
|
seek: (type) ->
|
||||||
|
if Conf['Mark Quotes of You'] and post = QuotesYou.cb.findPost type
|
||||||
|
Quotesyou.cb.scroll post
|
||||||
|
|
||||||
|
findPost: (type) ->
|
||||||
|
posts = $$ '.quotesYou'
|
||||||
|
unless QuoteMarkers.lastRead
|
||||||
|
unless post = QuoteMarkers.lastRead = posts[0]
|
||||||
|
new Notice 'warning', 'No posts are currently quoting you, loser.', 20
|
||||||
|
return
|
||||||
|
unless Get.postFromRoot(post).isHidden
|
||||||
|
return post
|
||||||
|
else
|
||||||
|
post = QuoteMarkers.lastRead
|
||||||
|
|
||||||
|
len = posts.length - 1
|
||||||
|
index = i = posts.indexOf post
|
||||||
|
while true
|
||||||
|
break if index is (
|
||||||
|
i = if i is 0
|
||||||
|
len
|
||||||
|
else if i is len
|
||||||
|
0
|
||||||
|
else if type is 'prev'
|
||||||
|
i - 1
|
||||||
|
else
|
||||||
|
i + 1
|
||||||
|
)
|
||||||
|
post = posts[i]
|
||||||
|
return post unless Get.postFromRoot(post).isHidden
|
||||||
|
|
||||||
|
scroll: (post) ->
|
||||||
|
$.rmClass highlight, 'highlight' if highlight = $ '.highlight'
|
||||||
|
QuoteMarkers.lastRead = post
|
||||||
|
window.location.hash = "##{post.id}"
|
||||||
|
Header.scrollTo post
|
||||||
|
$.addClass $('.post', post), 'highlight'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user