Skip to content

Instantly share code, notes, and snippets.

@dev-black
Last active February 7, 2017 15:30
Show Gist options
  • Save dev-black/2cd0d9c24761873101db33657c9609e2 to your computer and use it in GitHub Desktop.
Save dev-black/2cd0d9c24761873101db33657c9609e2 to your computer and use it in GitHub Desktop.
Xóa lời mời kết bạn đã gửi trên Facebook
/* go to link: https://www.facebook.com/friends/requests/?fcref=jwl&outgoing=1 */
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var user_id = document.cookie.match(/c_user=(\d+)/)[1];
var list = document.querySelectorAll('.FriendRequestOutgoing:not(.hidden_elem)');
for (var i in list) {
if (typeof list[i] == 'object') {
var uid = list[i].getAttribute('data-profileid');
var http = new XMLHttpRequest();
http.open("POST", "https://www.facebook.com/ajax/friends/requests/cancel.php");
http.send("friend=" + uid + "&cancel_ref=outgoing_requests&__user=" + user_id + "&__a=1&fb_dtsg=" + fb_dtsg + "&confirmed=1");
http.onreadystatechange = function() {
if (http.readyState == 4) {
if (http.responseText.match('cancel')) {
console.log('thành công !');
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment