Want more features on Pastebin? Sign Up, it's FREE!
Guest

Facebook "ordered friends"

By: bossylobster on Nov 30th, 2012  |  syntax: JavaScript  |  size: 1.35 KB  |  views: 9,511  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Go to facebook.com
  2. // View source in Chrome
  3. // Right click anywhere and click "Inspect Element" to open developer tools
  4. // Click the little arrow with 3 lines by it to bring up the console
  5. // paste this gunk into the console
  6.  
  7. body = document.getElementsByTagName('body')[0]
  8. table = body.getElementsByTagName('table')[0]
  9. tbody = table.getElementsByTagName('tbody')[0]
  10. tr_list = tbody.getElementsByTagName('tr')
  11. for (index = 0; index < tr_list.length; index++) {
  12.   tr = tr_list[index]
  13.   td = tr.getElementsByClassName('webkit-line-content')[0];
  14.   txt = td.textContent;
  15.   if (txt.substr(0, 61) == '<script>bigPipe.onPageletArrive({"content":{"pagelet_sidebar"') {
  16.     break;
  17.   }
  18. }
  19. txt = txt.substr(32)
  20. txt = txt.substr(0, txt.length - 10)
  21. json_payload = JSON.parse(txt)
  22. jsmods = json_payload.jsmods
  23. define = jsmods.define
  24. orderedfriends = define[define.length - 1]
  25. list_list = orderedfriends[2]
  26. list = list_list.list
  27. friend_uris = []
  28. for (index = 0; index < list.length; index++) { friend_uris.push('https://www.facebook.com/' + list[index]); }
  29. function goToFriend(numeral) { window.location = friend_uris[numeral - 1]; }
  30.  
  31.  
  32. // If you want to see the person first on the list type
  33. goToFriend(1)
  34. // and you'll be redirected there
  35.  
  36.  
  37. // If you want to see the person second on the list type
  38. goToFriend(2)
  39. // and you'll be redirected there
  40.  
  41.  
  42. etc.
clone this paste RAW Paste Data