Merge pull request #13 from olinpin/feat/sort-tweets
Added sort by time
This commit is contained in:
		| @@ -154,21 +154,26 @@ function filterReplies(repliesTop, repliesBottom, tweets){ | ||||
|     return tweets | ||||
| } | ||||
|  | ||||
| function sortTweets(tweets, likesDes=null, retweets=null, replies=null){ | ||||
| function sortTweets(tweets, likesDes=null, retweetsDes=null, repliesDes=null, dateDes=null){ | ||||
|     if(likesDes && likesDes!=null){ | ||||
|         tweets.sort(function(a,b){return b.favorite_count-a.favorite_count}) | ||||
|     } else if (!likesDes && likesDes!=null){ | ||||
|         tweets.sort(function(a,b){return a.favorite_count-b.favorite_count}) | ||||
|     } | ||||
|     if(retweets && retweets!=null){ | ||||
|     if(retweetsDes && retweetsDes!=null){ | ||||
|         tweets.sort(function(a,b){return b.retweet_count-a.retweet_count}) | ||||
|     } else if (!retweets && retweets!=null){ | ||||
|     } else if (!retweetsDes && retweetsDes!=null){ | ||||
|         tweets.sort(function(a,b){return a.retweet_count-b.retweet_count}) | ||||
|     } | ||||
|     if(replies && replies!=null){ | ||||
|     if(repliesDes && repliesDes!=null){ | ||||
|         tweets.sort(function(a,b){return b.reply_count-a.reply_count}) | ||||
|     } else if (!replies && replies!=null){ | ||||
|     } else if (!repliesDes && repliesDes!=null){ | ||||
|         tweets.sort(function(a,b){return a.reply_count-b.reply_count}) | ||||
|     } | ||||
|     if(dateDes && dateDes!=null){ | ||||
|         tweets.sort(function(a,b){return Date(b.created_at)-Date(a.reply_count)}) | ||||
|     } else if (!dateDes && dateDes!=null){ | ||||
|         tweets.sort(function(a,b){return Date(a.created_at)-Date(b.reply_count)}) | ||||
|     } | ||||
|     return tweets | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 GitHub
						GitHub