post/anchor component

v1.18.x
psychobunny 10 years ago
parent d347e88361
commit eba0f32913

@ -11,6 +11,10 @@ var components = components || {};
'post/header': function(pid) { 'post/header': function(pid) {
var el = $('[data-pid="' + pid + '"]').find('[component="post/header"]'); var el = $('[data-pid="' + pid + '"]').find('[component="post/header"]');
return el.length ? el : $('#topic_title_' + pid); // deprecated after 0.7x return el.length ? el : $('#topic_title_' + pid); // deprecated after 0.7x
},
'post/anchor': function(pid) {
var el = $('[data-pid="' + pid + '"]').find('[component="post/anchor"]');
return el.length ? el : $('#post_anchor_' + pid); // deprecated after 0.7x
} }
}; };

@ -161,7 +161,7 @@ define('navigator', ['forum/pagination'], function(pagination) {
duration = duration !== undefined ? duration : 400; duration = duration !== undefined ? duration : 400;
navigator.scrollActive = true; navigator.scrollActive = true;
if($('#post_anchor_' + postIndex).length) { if(components.get('post/anchor', postIndex).length) {
return scrollToPid(postIndex, highlight, duration, offset); return scrollToPid(postIndex, highlight, duration, offset);
} }
@ -188,7 +188,7 @@ define('navigator', ['forum/pagination'], function(pagination) {
}; };
function scrollToPid(postIndex, highlight, duration, offset) { function scrollToPid(postIndex, highlight, duration, offset) {
var scrollTo = $('#post_anchor_' + postIndex); var scrollTo = components.get('post/anchor', postIndex);
if (!scrollTo) { if (!scrollTo) {
navigator.scrollActive = false; navigator.scrollActive = false;

Loading…
Cancel
Save