Browse Source

fix of ordering in postboard showPosts()

master
Simon Grim 10 years ago
parent
commit
4ee5ee0bde
  1. 15
      js/twister_timeline.js

15
js/twister_timeline.js

@ -216,19 +216,22 @@ function showPosts(req, posts)
} }
} }
if (!streamPostAppended) { if (!streamPostAppended) {
var timeClosest = 0;
for (var j = 0; j < streamItems.length; j++) { for (var j = 0; j < streamItems.length; j++) {
var streamItem = streamItems.eq(j); var streamItem = streamItems.eq(j);
var timeItem = streamItem.attr("data-time"); var timeItem = parseInt(streamItem.attr("data-time"));
if( timeItem == undefined || if (timePost > timeItem && timeItem > timeClosest) {
timePost > parseInt(timeItem) ) { timeClosest = timeItem;
var streamItemClosest = streamItem;
}
}
if (timeClosest) {
// this post in stream is older, so post must be inserted above // this post in stream is older, so post must be inserted above
streamItem.before(streamPost); streamItemClosest.before(streamPost);
streamItems[streamItems.length] = streamPost[0]; streamItems[streamItems.length] = streamPost[0];
streamItems.length += 1; streamItems.length += 1;
streamPostAppended = true; streamPostAppended = true;
streamPost.show(); streamPost.show();
break;
}
} }
} }
} }

Loading…
Cancel
Save