Forked from adriaanm/fb_delete_allgroupmembers.js
Last active
December 18, 2015 07:00
-
-
Save babrath/5743753 to your computer and use it in GitHub Desktop.
Some javascript code that allows you to automatically delete all members from a facebook group.
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
// first go to https://www.facebook.com/groups/XXXX/members/ | |
// then paste this in the javascript console | |
deleteAll = []; | |
deleteAll.elms = []; | |
deleteAll.canClick = function (el) { | |
return (typeof el != 'undefined') && (typeof el.click != 'undefined'); | |
} | |
deleteAll.load = function() { | |
deleteAll.elms = document.getElementsByClassName("uiPopoverButton _p uiButton uiButtonSuppressed uiButtonNoText"); | |
if (i < deleteAll.elms.length - 5 && !more[0].hasChildNodes()) { | |
setTimeout(deleteAll.getMore, 1000); | |
} else { | |
setTimeout(deleteAll.go, 2000); | |
} | |
} | |
deleteAll.getMore = function() { | |
more = document.getElementsByClassName("pam uiBoxLightblue uiMorePagerPrimary"); | |
if (typeof more != 'undefined' && deleteAll.canClick(more[0])) { | |
more[0].click(); | |
setTimeout(deleteAll.load, 2000); | |
} else { | |
setTimeout(deleteAll.load, 100); | |
} | |
} | |
deleteAll.go = function() { | |
try { | |
deleteAll.doClick(1); | |
} catch(e) { | |
setTimeout(deleteAll.load, 1000); | |
} finally { | |
setTimeout(deleteAll.load, 500000); | |
} | |
} | |
deleteAll.doClick = function(i) { | |
deleteAll.elms[i].click(); | |
setTimeout(function(){deleteAll.doClick2(i)}, 1000); | |
} | |
deleteAll.doClick2 = function(i) { | |
document.getElementsByClassName("_54nc")[1].click() | |
setTimeout(function(){deleteAll.confirm(i)}, 1000); | |
} | |
deleteAll.confirm = function (i) { | |
remove_but = document.getElementsByClassName("_42ft _42fu layerConfirm uiOverlayButton selected _42g- _42gy")[0]; | |
more = document.getElementsByClassName("pam uiBoxLightblue uiMorePagerPrimary"); | |
if ((i < deleteAll.elms.length - 5 || !more[0].hasChildNodes()) && deleteAll.canClick(remove_but) && remove_but.value == "1") { | |
remove_but.click(); | |
setTimeout(function(){deleteAll.confirm2(i)}, 1000); | |
} else { | |
setTimeout(deleteAll.getMore, 2000); | |
} | |
} | |
deleteAll.confirm2 = function(i) { | |
node = document.getElementsByClassName('uiContextualLayerPositioner uiLayer hidden_elem')[0]; | |
node.parentNode.removeChild(node); | |
setTimeout(function(){deleteAll.doClick(i)}, 1000); | |
} | |
deleteAll.load(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do you run this on Mac Chrome?? Please help I need to delete two groups ASAP