From eba0f32913308146949a2a80dbd8b18cb2ec2706 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 17 Mar 2015 12:54:10 -0400 Subject: [PATCH] post/anchor component --- public/src/components.js | 4 ++++ public/src/modules/navigator.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/src/components.js b/public/src/components.js index 89b21585be..3b02cc04b6 100644 --- a/public/src/components.js +++ b/public/src/components.js @@ -11,6 +11,10 @@ var components = components || {}; 'post/header': function(pid) { var el = $('[data-pid="' + pid + '"]').find('[component="post/header"]'); 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 } }; diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index e7f78c980f..71fb90ac2d 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -161,7 +161,7 @@ define('navigator', ['forum/pagination'], function(pagination) { duration = duration !== undefined ? duration : 400; navigator.scrollActive = true; - if($('#post_anchor_' + postIndex).length) { + if(components.get('post/anchor', postIndex).length) { return scrollToPid(postIndex, highlight, duration, offset); } @@ -188,7 +188,7 @@ define('navigator', ['forum/pagination'], function(pagination) { }; function scrollToPid(postIndex, highlight, duration, offset) { - var scrollTo = $('#post_anchor_' + postIndex); + var scrollTo = components.get('post/anchor', postIndex); if (!scrollTo) { navigator.scrollActive = false;