Baris Soner Usakli 11 years ago
commit 24ceb0f083

@ -321,6 +321,17 @@ define(['composer'], function(composer) {
$('#post-container').on('click', '.deleted', function(ev) { $('#post-container').on('click', '.deleted', function(ev) {
$(this).toggleClass('deleted-expanded'); $(this).toggleClass('deleted-expanded');
}); });
// Show the paginator block, now that the DOM has finished loading
(function delayedHeaderUpdate() {
if (!Topic.postCount) {
setTimeout(function() {
delayedHeaderUpdate();
}, 25);
} else {
updateHeader();
}
})();
}); });
function enableInfiniteLoading() { function enableInfiniteLoading() {
@ -893,7 +904,6 @@ define(['composer'], function(composer) {
Topic.postCount = templates.get('postcount'); Topic.postCount = templates.get('postcount');
window.onscroll = updateHeader; window.onscroll = updateHeader;
window.onload = updateHeader;
}; };
function updateHeader() { function updateHeader() {
@ -957,7 +967,7 @@ define(['composer'], function(composer) {
}); });
setTimeout(function() { setTimeout(function() {
if (scrollTop + windowHeight == jQuery(document).height()) { if (scrollTop + windowHeight == jQuery(document).height() && !infiniteLoaderActive) {
pagination.innerHTML = Topic.postCount + ' out of ' + Topic.postCount; pagination.innerHTML = Topic.postCount + ' out of ' + Topic.postCount;
progressBar.width('100%'); progressBar.width('100%');
} }
@ -1099,11 +1109,10 @@ define(['composer'], function(composer) {
return; return;
} }
infiniteLoaderActive = true;
if (indicatorEl.attr('done') === '0') { if (indicatorEl.attr('done') === '0') {
infiniteLoaderActive = true;
indicatorEl.fadeIn(); indicatorEl.fadeIn();
}
socket.emit('topics.loadMore', { socket.emit('topics.loadMore', {
tid: tid, tid: tid,
@ -1119,13 +1128,17 @@ define(['composer'], function(composer) {
createNewPosts(data, true); createNewPosts(data, true);
} else { } else {
indicatorEl.attr('done', '1'); indicatorEl.attr('done', '1');
updateHeader();
} }
indicatorEl.fadeOut(); indicatorEl.fadeOut();
if (callback) { if (callback) {
callback(data.posts); callback(data.posts);
} }
}); });
} }
}
return Topic; return Topic;
}); });

@ -294,7 +294,7 @@ var path = require('path'),
return callback(err, null); return callback(err, null);
} }
topics.getTopicsByTids(tids, 0, 0, function (topics) { topics.getTopicsByTids(tids, 0, 0, function (err, topics) {
callback(null, topics); callback(null, topics);
}); });
}); });

Loading…
Cancel
Save