added postcount to topics return; started scrollspy behaviour for "postid / postcount" in topics.

v1.18.x
psychobunny 12 years ago
parent f251b9c6c5
commit 469a5221ed

@ -605,12 +605,15 @@
var postAuthorImage, postAuthorInfo;
var postAuthorImage, postAuthorInfo, pagination;
var postcount = templates.get('postcount');
function updateHeader() {
jQuery('.post-author-info').css('bottom', '0px');
postAuthorImage = postAuthorImage || document.getElementById('post-author-image');
postAuthorInfo = postAuthorInfo || document.getElementById('post-author-info');
pagination = pagination || document.getElementById('pagination');
var scrollTop = jQuery(window).scrollTop();
var scrollBottom = scrollTop + jQuery(window).height();
@ -618,10 +621,18 @@
if (scrollTop < 50) {
postAuthorImage.src = (jQuery('.main-avatar img').attr('src'));
postAuthorInfo.innerHTML = 'Posted by ' + jQuery('.main-post').attr('data-username') + ', ' + jQuery('.main-post').find('.relativeTimeAgo').html();
pagination.innerHTML = '0 / ' + postcount;
return;
}
var count = 0;
jQuery('.sub-posts').each(function() {
count++;
this.postnumber = count;
var el = jQuery(this);
var elTop = el.offset().top;
var height = Math.floor(el.height());
@ -632,12 +643,15 @@
if (inView) {
pagination.innerHTML = this.postnumber + ' / ' + postcount;
postAuthorImage.src = (jQuery(this).find('.profile-image-block img').attr('src'));
postAuthorInfo.innerHTML = 'Posted by ' + jQuery(this).attr('data-username') + ', ' + jQuery(this).find('.relativeTimeAgo').html();
}
});
if (scrollTop >= jQuery(window).height()) {
//pagination.innerHTML = postcount + ' / ' + postcount;
}
}
window.onscroll = updateHeader;

@ -42,7 +42,9 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">{title}</a>
<a class="navbar-brand" href="/">{title}<div id="pagination">
0 / 0
</div></a>
</div>
<div class="navbar-collapse collapse">
@ -56,7 +58,12 @@
<li>
<a href="/users">Users</a>
</li>
<li>
<a href="/"></a>
</li>
</ul>
<ul id="right-menu" class="nav navbar-nav pull-right">
<li class="notifications dropdown text-center">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="notif_dropdown"><i class="icon-circle-blank"></i></a>

@ -234,6 +234,7 @@
<input type="hidden" template-variable="deleted" value="{deleted}" />
<input type="hidden" template-variable="pinned" value="{pinned}" />
<input type="hidden" template-variable="topic_name" value="{topic_name}" />
<input type="hidden" template-variable="postcount" value="{postcount}" />

@ -379,6 +379,7 @@ marked.setOptions({
'deleted': topicData.deleted,
'pinned': topicData.pinned,
'slug': topicData.slug,
'postcount' : topicData.postcount,
'topic_id': tid,
'expose_tools': privileges.editable ? 1 : 0,
'posts': topicPosts,

Loading…
Cancel
Save