Forked from sezgi/facebook-delete-all-group-members.js
Last active
September 15, 2017 14:43
-
-
Save nbouliol/a4f0d0cde3eb102a895562d1b7bbfa12 to your computer and use it in GitHub Desktop.
Deletes all group members from a facebook group except yourself. Leaving the group after running this in the javascript console will delete the group. Tested on Chrome May 29, 2017. If your network is super slow, you might want to increase the timeout delay.
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
// removes your box from the page so you don't get removed from the group | |
$$('[data-name=GroupProfileGridItem]')[0].remove(); | |
// member action dropdowns | |
const actions = $$('.adminActions'); | |
// open all dropdowns so they're added to the DOM | |
for (var i = 0; i < actions.length; i++) { | |
$$('.adminActions button')[i] && $$('.adminActions button')[i].click(); | |
} | |
// leave group buttons | |
const buttons = $$('[data-testid=leave_group]'); | |
var i = 0; | |
function removeAll() { | |
setTimeout(function () { | |
// click each button | |
buttons[i].click(); | |
// click confirm button with a half second delay | |
setTimeout(function() { | |
document.getElementsByClassName('layerConfirm')[0].click() | |
}, 500); | |
i++; | |
if (i < buttons.length) { | |
// each time this is called, there will be a 3 second delay | |
removeAll(); | |
} | |
}, 3000); | |
} | |
removeAll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment