macbroadcast´s blog


Find your Facebook Friends Ranking Score !!
March 29, 2014, 5:18 pm
Filed under: Facebook, globalchange, socialweb, society | Tags: , ,

(UPDATE [Dec 18]: Code and Link updated since Facebook changed some of their code)

Drag and drop the following link to your browser’s bookmarks bar:

FB Friends Ranking

Log in to your facebook and then click on the bookmark.

You should see your Friends’ Rating Score. Smaller the friend’s score, higher the rank.

It also shows scores for not only users; also for groups, pages etc and your ranking factors like high-school, college, employer, topics etc.

Surprised that facebook knows who you stalk?, Sure you are not !! 🙂

 

The Code:

function creator(o, data, node){
	var content = document.createElement(node);
	content.cellspacing = "3"
	var cell = document.createTextNode(data);
	content.appendChild(cell);
	o.appendChild(content);
}
function displayData(arr){
	var table = document.createElement('table');
	var thead = document.createElement('thead');
	table.appendChild(thead);
	var row = document.createElement('tr');
	creator(row, 'Name', 'th');
	creator(row, 'Type', 'th');
	creator(row, 'Score', 'th');
	thead.appendChild(row);
	var tbody = document.createElement('tbody');
	table.appendChild(tbody);
	for(i=0; i < arr.length; i++){console.log(arr[i]);
		var type = arr[i].type;
		var row = document.createElement('tr');
		creator(row, arr[i]["text"], 'td');
		creator(row, Object.keys(arr[i]["grammar_costs"])[0].slice(0,-1).substring(1), 'td');
		creator(row, arr[i]["grammar_costs"][Object.keys(arr[i]["grammar_costs"])[0]], 'td');
		tbody.appendChild(row);
	}
	document.body.innerHTML = "";
	document.body.appendChild(table);
}

id = requireDynamic("Env").user || requireDynamic("CurrentUserInitialData")["id"];
url = "//www.facebook.com/ajax/typeahead/search/facebar/bootstrap/?viewer=" + id + "&__a=1";
x = new XMLHttpRequest();
x.onreadystatechange=function(){
  if (x.readyState==4 && x .status==200){
    srr=JSON.parse(x.responseText.substring(9)).payload.entries;
    displayData(srr);
  }
}
x.open("GET",url,true);
x.send();

On Github: github.com/arjun024/facebook-friends-ranking-score

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: