Last active
September 13, 2018 20:30
-
-
Save edomora97/2a317bc5c594f477581f to your computer and use it in GitHub Desktop.
Facebook friends affinity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b=document.querySelector("img[id^='profile_pic_header_']").id.substr(19),c;c=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");c.onreadystatechange=function(){if(4==c.readyState&&200==c.status){var a=c.responseText,a=a.substr(9),a=JSON.parse(a).payload.entries;console.log(a);document.body.innerHTML="";document.write("<title>Affinit\u00e0 con i tuoi amici</title><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Rancho&effect=shadow-multiple'><style>a{text-decoration:none;color:#333;}a:hover,a:focus{text-decoration:underline;}a:visited{color:#333;}img{height:25px;border-radius:25px;border:2px solid;float:left;margin-right:5px}table{cursor:default;margin:20px;background:#e9e9e9;font-family:'Rancho';font-size:25px;}th{border-bottom:1px solid white;background:#e0e0e0;}th,td{border-left:1px solid white;border-right:1px solid white;}tr{transition:all .4s;}td,th{transition:all .4s;padding:0;}th{padding:10px;}tr:hover,tr:focus{background:rgba(255, 255, 255, 0.20);}td:hover,td:focus,th:hover,th:focus{transform:scale(1.05);background:rgba(255, 255, 255, 0.25);}td:active,th:active{transform: scale(0.95);}td:first-of-type{text-align:right;padding-right:5px;}div{width:100%;height:20px;margin:10px;line-height:30px;}.page{background:#e0e9e0;}.group{background:#e0e0e9;}.app{background:#e9e0e0;}</style>");document.write("<table class='font-effect-shadow-multiple'>");document.write("<tr><th>#</th><th>Nome</th><th>Categoria/Residenza</th><th>Affinit\u00e0</th></tr>");for(i in a)a[i].text&&0!=i&&(document.write("<tr class='"+a[i].type+"'>"),document.write("<td>"+i),document.write("<td><a href='"+a[i].path+"'><div><img src='"+a[i].photo+"'>"+a[i].text),document.write("<td>"+a[i].subtext+"</td>"),document.write("<td>"+(100-100*a[i].index).toFixed(2)+"%"))}};c.open("GET","https://www.facebook.com/ajax/typeahead/search/bootstrap.php?filter=user&__a=1&viewer="+b,!0);c.send(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* By Edoardo Morassutto and Giorgio Garasto | |
*/ | |
function select(query) { | |
return document.querySelector(query); | |
} | |
var profile_link = select("img[id^='profile_pic_header_']"); | |
var userId = profile_link.id.substr(19); | |
var xmlhttp; | |
if (window.XMLHttpRequest) | |
xmlhttp=new XMLHttpRequest(); | |
else | |
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState==4 && xmlhttp.status==200) { | |
var data = xmlhttp.responseText; | |
data = data.substr(9); | |
var entries = JSON.parse(data)["payload"]["entries"]; | |
console.log(entries); | |
document.body.innerHTML = ''; | |
document.write("<title>Affinit\u00e0 con i tuoi amici</title><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Rancho&effect=shadow-multiple'><style>a{text-decoration:none;color:#333;}a:hover,a:focus{text-decoration:underline;}a:visited{color:#333;}img{height:25px;border-radius:25px;border:2px solid;float:left;margin-right:5px}table{cursor:default;margin:20px;background:#e9e9e9;font-family:'Rancho';font-size:25px;}th{border-bottom:1px solid white;background:#e0e0e0;}th,td{border-left:1px solid white;border-right:1px solid white;}tr{transition:all .4s;}td,th{transition:all .4s;padding:0;}th{padding:10px;}tr:hover,tr:focus{background:rgba(255, 255, 255, 0.20);}td:hover,td:focus,th:hover,th:focus{transform:scale(1.05);background:rgba(255, 255, 255, 0.25);}td:active,th:active{transform: scale(0.95);}td:first-of-type{text-align:right;padding-right:5px;}div{width:100%;height:20px;margin:10px;line-height:30px;}.page{background:#e0e9e0;}.group{background:#e0e0e9;}.app{background:#e9e0e0;}</style>"); | |
document.write("<table class='font-effect-shadow-multiple'>"); | |
document.write("<tr><th>#</th><th>Nome</th><th>Categoria/Residenza</th><th>Affinit\u00e0</th></tr>"); | |
for (i in entries) { | |
if (entries[i]["text"] && i!=0) { | |
document.write("<tr class='" + entries[i]["type"] + "'>"); | |
document.write("<td>" + i); | |
document.write("<td><a href='" + entries[i]["path"] + "'><div><img src='" + entries[i]["photo"] + "'>" + entries[i]["text"]); | |
document.write("<td>" + entries[i]["subtext"] + "</td>"); | |
document.write("<td>" + (100-entries[i]["index"]*100).toFixed(2) + "%"); | |
} | |
} | |
} | |
} | |
xmlhttp.open("GET","https://www.facebook.com/ajax/typeahead/search/bootstrap.php?filter=user&__a=1&viewer="+userId,true); | |
xmlhttp.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment