Created
October 16, 2017 19:34
-
-
Save sayhicoelho/fb9a370688a8fc21d435f08aa2747869 to your computer and use it in GitHub Desktop.
Facebook: The easiest way to accept all of friend request list
This file contains hidden or 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 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