Last active
January 7, 2019 13:20
-
-
Save conorluddy/26b90d5f0c05d712252ac272ae47708c to your computer and use it in GitHub Desktop.
If you have a Facebook group with a large list of pending member requests, running this will find the people who have existing friends in the group, or mutual friends with you, and programatically click their 'Approve' button.
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
/** | |
* If you have a Facebook group with a large list of pending member requests, | |
* running this will find the people who have existing friends in the group, | |
* or mutual friends with you, and programatically click their 'Approve' button. | |
* | |
* Obviously it will only work on items that have been loaded into the DOM already, | |
* so if the list is long keep scrolling until you reach the end of it before running this. | |
* | |
* DOM traversal was accurate at the time of creation, but I'm not responsible for | |
* you running this after Facebook refactor their HTML/React templates and banning everyone | |
* on the list! :D | |
* | |
* Hope it saves you some time! | |
**/ | |
var f=document.querySelectorAll('[href*=requesters_friends_in_group],[href*=mutual_friend]'); | |
for (var i = 0; i < f.length; i++) { | |
f[i].parentNode.parentNode.parentNode.parentNode.parentNode.querySelectorAll('[ajaxify]')[0].click(); | |
} | |
//Bookmarklet version | |
javascript:(function(){var f=document.querySelectorAll('[href*=requesters_friends_in_group],[href*=mutual_friend]');for(var i = 0; i < f.length; i++){f[i].parentNode.parentNode.parentNode.parentNode.parentNode.querySelectorAll('[ajaxify]')[0].click();}})(); | |
//Bookmarklet version with alert for number of additions. | |
javascript:(function(){var f=document.querySelectorAll('[href*=requesters_friends_in_group],[href*=mutual_friend]');for(var i = 0; i < f.length; i++){f[i].parentNode.parentNode.parentNode.parentNode.parentNode.querySelectorAll('[ajaxify]')[0].click();} alert(f.length + ' people added to the group.');})(); | |
//Let people who seem Irish in... | |
var links=document.querySelectorAll('#pagelet_requests_queue .profileLink'), irish=[], linkText, addLink; | |
for(var i=0;i<links.length;i++){ | |
linkText = links[i].innerHTML.toLowerCase(); | |
if(linkText.indexOf('ireland') > -1 || linkText.indexOf('dublin') > -1 || linkText.indexOf('galway') > -1){ | |
irish.push(links[i]); | |
} | |
} | |
for(var i=0;i<irish.length;i++){ | |
addLink = irish[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.querySelectorAll('[ajaxify]')[0]; | |
if(addLink && addLink.innerHTML.indexOf('approve')) { | |
addLink.click(); | |
} | |
} | |
alert(irish.length + ' Irish people added...'); | |
//Bookmarklet | |
javascript:(function(){ | |
var links=document.querySelectorAll('#pagelet_requests_queue .profileLink'), irish=[], linkText, addLink; | |
for(var i=0;i<links.length;i++){ | |
linkText = links[i].innerHTML.toLowerCase(); | |
if(linkText.indexOf('ireland') > -1 || linkText.indexOf('dublin') > -1 || linkText.indexOf('galway') > -1){ | |
irish.push(links[i]); | |
} | |
} | |
for(var i=0;i<irish.length;i++){ | |
addLink = irish[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.querySelectorAll('[ajaxify]')[0]; | |
if(addLink && addLink.innerHTML.indexOf('approve')) { | |
addLink.click(); | |
} | |
} | |
alert(irish.length + ' Irish people added...'); | |
})(); | |
//Clicks all visible Block buttons. Use care. I use it with the sort feature and sort by recent joins | |
javascript:(function(){ | |
var links=document.querySelectorAll('#pagelet_requests_queue [ajaxify]'); | |
for(var i=0;i<links.length;i++){ | |
if(links && links[i].innerHTML.toLowerCase().indexOf('block')) {links[i].click();} | |
} | |
alert(links.length + ' people blocked...'); | |
})(); | |
//Ignore users that joined Facebook recently. They can re-apply again in future as they aren't blocked. | |
var f=document.querySelectorAll('.uiList.mts._2rct._4kg'); | |
for (var i = 0; i < f.length; i++) { | |
if(f[i].innerHTML.indexOf('Joined Facebook less than') !== -1) { | |
f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[1].click(); | |
} | |
console.info('New users ignored'); | |
} | |
//Bookmarklet version | |
javascript:(function(){var f=document.querySelectorAll('.uiList.mts._2rct._4kg');for (var i = 0; i < f.length; i++) {if(f[i].innerHTML.indexOf('Joined Facebook less than') !== -1) {f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[1].click();}console.info('New users ignored');}})(); | |
//Block users that joined Facebook recently. | |
var f=document.querySelectorAll('.uiList.mts._2rct._4kg'); | |
for (var i = 0; i < f.length; i++) { | |
if(f[i].innerHTML.indexOf('Joined Facebook less than') !== -1) { | |
f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[2].click(); | |
} | |
console.info('New facebook users blocked'); | |
} | |
//Bookmarklet version | |
javascript:(function(){var f=document.querySelectorAll('.uiList.mts._2rct._4kg');for (var i = 0; i < f.length; i++) {if(f[i].innerHTML.indexOf('Joined Facebook less than') !== -1) {f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[2].click();}console.info('New Facebook users blocked');}})(); | |
//Allow users that have Ireland mentioned in their card | |
var f=document.querySelectorAll('.uiList.mts._2rct._4kg'); | |
for (var i = 0; i < f.length; i++) { | |
if(f[i].parentNode.innerHTML.indexOf('Ireland') !== -1) { | |
f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[0].click(); | |
console.info('Irish users added'); | |
} | |
} | |
//Bookmarklet version | |
javascript:(function(){var f=document.querySelectorAll('.uiList.mts._2rct._4kg');for (var i = 0; i < f.length; i++) {if(f[i].parentNode.innerHTML.indexOf('Ireland') !== -1) {f[i].parentNode.parentNode.querySelectorAll('[ajaxify]')[0].click();console.info('Irish users added');}}})(); |
Sorry @rabimba, I only saw your comment now. Nope, I haven't used this recently and I never needed to use anything similar since, sorry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was a nifty one. Guessing it wont work anymore. But did you ever come up with something with similar filtering?