inf scroll changes

dont load main post if start > 0
This commit is contained in:
barisusakli
2015-09-24 21:14:34 -04:00
parent 137f2097db
commit c617a3f008
9 changed files with 127 additions and 153 deletions

View File

@@ -61,7 +61,7 @@ SocketCategories.loadMore = function(socket, data, callback) {
return callback(new Error('[[error:no-privileges]]'));
}
var infScrollTopicsPerPage = 20;
var set = 'cid:' + data.cid + ':tids',
reverse = false;
@@ -72,8 +72,16 @@ SocketCategories.loadMore = function(socket, data, callback) {
set = 'cid:' + data.cid + ':tids:posts';
}
var start = parseInt(data.after, 10),
stop = start + results.settings.topicsPerPage - 1;
var start = Math.max(0, parseInt(data.after, 10)) + 1;
if (data.direction === -1) {
start = start - (reverse ? infScrollTopicsPerPage : -infScrollTopicsPerPage);
}
var stop = start + infScrollTopicsPerPage - 1;
start = Math.max(0, start);
stop = Math.max(0, stop);
if (results.targetUid) {
set = 'cid:' + data.cid + ':uid:' + results.targetUid + ':tids';