Browse Source

fix of ordering in postboard showPosts()

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

23
js/twister_timeline.js

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

Loading…
Cancel
Save