Skip to content

Instantly share code, notes, and snippets.

@sayhicoelho
Created October 16, 2017 19:34
Show Gist options
  • Save sayhicoelho/fb9a370688a8fc21d435f08aa2747869 to your computer and use it in GitHub Desktop.
Save sayhicoelho/fb9a370688a8fc21d435f08aa2747869 to your computer and use it in GitHub Desktop.
Facebook: The easiest way to accept all of friend request list
var interval;
var morePagerInterval;
var index = 0;
interval = setInterval(function() {
console.clear();
var requests = document.querySelectorAll('.friendRequestItem');
if (index >= requests.length) {
console.info('Looks like you reached at the end. Please reload the page if you need to accept more friends.');
clearInterval(interval);
} else {
var button = requests[index].querySelector('button.selected');
button.click();
index++;
console.log('Friends accepted: ' + (index + 1));
}
}, 1000);
morePagerInterval = setInterval(function () {
var button = document.getElementById('FriendRequestMorePager');
if (button != null) {
button.getElementsByTagName('a')[0].click();
} else {
console.warn('More Pager reached at the end of the bottom!');
clearInterval(morePagerInterval);
}
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment