Browse Source

delete unnecessary check in a loop in processDMsnippet()

master
Simon Grim 10 years ago
parent
commit
7082d0aedd
  1. 28
      js/twister_directmsg.js

28
js/twister_directmsg.js

@ -20,23 +20,21 @@ function processDMsnippet(dmUsers, dmThreadList) {
dmThreadList.empty(); dmThreadList.empty();
for (var u in dmUsers) { for (var u in dmUsers) {
if (dmUsers[u]) { // convert snipped to html and add it to date-sorted list
// convert snipped to html and add it to date-sorted list var dmItem = dmDataToSnippetItem(dmUsers[u][0], u);
var dmItem = dmDataToSnippetItem(dmUsers[u][0], u); var timeDmItem = parseInt(dmItem.attr('data-time'));
var timeDmItem = parseInt(dmItem.attr('data-time')); var existingItems = dmThreadList.children();
var existingItems = dmThreadList.children(); for (var j = 0; j < existingItems.length; j++) {
for (var j = 0; j < existingItems.length; j++) { var streamItem = existingItems.eq(j);
var streamItem = existingItems.eq(j); var timeExisting = streamItem.attr('data-time');
var timeExisting = streamItem.attr('data-time'); if (typeof timeExisting === 'undefined' || timeDmItem > parseInt(timeExisting)) {
if (typeof timeExisting === 'undefined' || timeDmItem > parseInt(timeExisting)) { // 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(dmItem);
streamItem.before(dmItem); break;
break;
}
} }
if (j === existingItems.length)
dmThreadList.append(dmItem);
} }
if (j === existingItems.length)
dmThreadList.append(dmItem);
} }
$.MAL.dmThreadListLoaded(); $.MAL.dmThreadListLoaded();
} }

Loading…
Cancel
Save