feed update: introduce reference point
This commit is contained in:
@@ -720,6 +720,8 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
|
||||
bDiscrete = bDiscrete || false;
|
||||
fCallback = fCallback || function(){};
|
||||
|
||||
if(bFirstChunk) self.tmp('ref_id', 0);
|
||||
|
||||
if(self.tmp('updatable')) {
|
||||
if(!self.tmp('out-of-data') || bFirstChunk) {
|
||||
self.tmp('updatable', false);
|
||||
@@ -736,12 +738,14 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
|
||||
function(asData) {
|
||||
$('#loading').hide();
|
||||
|
||||
$.each(asData, function(iKey, asPost){
|
||||
self.tmp('ref_id', asData.ref_id);
|
||||
|
||||
$.each(asData.feed, function(iKey, asPost){
|
||||
$Posts.append(getPost(asPost));
|
||||
});
|
||||
|
||||
self.tmp('news_chunk', self.tmp('news_chunk') + 1);
|
||||
self.tmp('out-of-data', Object.keys(asData).length != self.vars('chunk_size'));
|
||||
self.tmp('out-of-data', Object.keys(asData.feed).length != self.vars('chunk_size'));
|
||||
|
||||
if(bFirstChunk===true) self.tmp('$PostList').empty();
|
||||
self.tmp('$PostList').append($Posts.children());
|
||||
@@ -751,7 +755,8 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
|
||||
self.tmp('updatable', true);
|
||||
}, {
|
||||
id_project: self.vars(['project', 'id']),
|
||||
chunk: self.tmp('news_chunk')
|
||||
chunk: self.tmp('news_chunk'),
|
||||
id: self.tmp('ref_id')
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user