'+ '
' + data.news[index].title + '
'+ ''+ '').appendTo('#mtnetblog-entries'); } // Merge all news var news_array = mtnet_news_data.item Array.prototype.push.apply(news_array, news_data.item); Array.prototype.push.apply(news_array, mtnetform_news_data.item); Array.prototype.push.apply(news_array, lekumoblog_news_data.item); Array.prototype.push.apply(news_array, mtnetsitesearch_news_data.item); // Sort by date news_array.sort(function(a, b) { var DateA = new Date(a.sortdate); var DateB = new Date(b.sortdate); return (DateA < DateB ? 1 : -1); }); // Extract pick up news var pickup_array = news_array.filter(function(item, index) { if ( item.pickup == "true" ) { return true; } }); // Output pickup news var alreadyExists = []; if ( pickup_array.length > 0 ) { var PICKUP_MAX = 2; if (PICKUP_MAX > pickup_array.length ) PICKUP_MAX = pickup_array.length; console.log(PICKUP_MAX); for (var i = 0; i < PICKUP_MAX; i++ ) { jQuery('div.top_pickup').append( '' + '
' + '' + '' + pickup_array[i].blogname + '' + '
' + '
' + pickup_array[i].title + '
' + '
' ); alreadyExists.push(pickup_array[i].url); } } // Output news var NEWS_MAX = 7; var cnt = 0; for (var i = 0; i < news_array.length ; i++){ if (jQuery.inArray(news_array[i].url, alreadyExists) == -1 ) { jQuery('#sa-entries') .append('
  • ' + news_array[i].title + '
  • ' ); cnt++; if (cnt == NEWS_MAX) { break; } } } });