|
|
@ -216,20 +216,23 @@ 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; |
|
|
|
// this post in stream is older, so post must be inserted above
|
|
|
|
var streamItemClosest = streamItem; |
|
|
|
streamItem.before(streamPost); |
|
|
|
|
|
|
|
streamItems[streamItems.length] = streamPost[0]; |
|
|
|
|
|
|
|
streamItems.length += 1; |
|
|
|
|
|
|
|
streamPostAppended = true; |
|
|
|
|
|
|
|
streamPost.show(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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) { |
|
|
|
if (!streamPostAppended) { |
|
|
|