/fb_delete_allgroupmembers.js
Forked from adriaanm/fb_delete_allgroupmembers.js// 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(); |
This comment has been minimized.
This comment has been minimized.
Go to your facebook group, go to the members tab (at that point your URL will be https://www.facebook.com/groups/XXXX/members/). Then open the javascript console (ctrl + shift + J in chrome), paste the above code, and enter. It'll start deleting all the members one by one, by performing scripted clicks on buttons, so this might take some time (a few secs per member I think). Also I think something might go wrong if it tries to delete someone that has already been deleted (or left), so I'd propose to start again once in a while to make sure it's actually still going. Also, protip: as you seem to have a lot of people to delete I'd suggest running the script on multiple tabs on the same time. Just open a new tab, go to the same page, add the code, but before entering make a small change. On line number 31 in this script change "deleteAll.doClick(1);", if you put '100' in stead of '1' it'll start with deleting member number 100 in the group in stead of member number 1. So have a tab with a script started on 1, have one started on 100, one on 200, etc. and it'll go much faster. Of course once the tab started on 1 gets to 100 and finds that member deleted it'll stop working. |
This comment has been minimized.
This comment has been minimized.
Thank you so much sir, You have done excellent job by making such a script ! But sometime that script goes into "The User is not member of this group" loop, but script is excellent and it works. |
This comment has been minimized.
This comment has been minimized.
I signed up to this website because I really wanted to let you know, thank you SOOOOO much! I have an obsolete group with 1645 members! I can't imagine how much time I would to spend to remove all members one by one! Your script works!!! |
This comment has been minimized.
This comment has been minimized.
Thanks, this saved my life! |
This comment has been minimized.
This comment has been minimized.
Great script, it saved me a lot of time but there's one problem. Sometimes it doesn't seem to hit the "Confirm" button and this causes a lot of confirmation windows to appear, and the "User is not a member of this group" loop @rohitbhide mentioned. Can you please try to fix this issue? |
This comment has been minimized.
This comment has been minimized.
it says undefined.. |
This comment has been minimized.
This comment has been minimized.
THANK YOU!!! I was looking for this..!! :) Can I find another similar script to delete all publications? |
This comment has been minimized.
This comment has been minimized.
that was awesome dude ^_^ deleteAll.canClick = function (el) { deleteAll.load = function() { deleteAll.getMore = function() { deleteAll.go = function() { deleteAll.doClick = function(i) { deleteAll.doClick2 = function(i) { deleteAll.confirm = function (i) { if ((i < deleteAll.elms.length - 5 || !more[0].hasChildNodes()) && deleteAll.canClick(remove_but) && remove_but.value == "1") { deleteAll.confirm2 = function(i) { deleteAll.load(); |
This comment has been minimized.
This comment has been minimized.
any update ? it isn't working help please |
This comment has been minimized.
This comment has been minimized.
Any update? not working for me either and I have 4000 people to remove |
This comment has been minimized.
This comment has been minimized.
it didn't work for me, |
This comment has been minimized.
This comment has been minimized.
This code works! Facebook disabled the native console brownser, but if you install the "Firebug" extension and run this script, it will work for you! This script does not delete the group, just all the other members and then terminates execution. |
This comment has been minimized.
This comment has been minimized.
IF YOU WANT NOT TO INSTALL THE FIREBUG EXTENSION, YOU CAN ACTIVATE THE USE OF THE CONSOLE HERE: https://www.facebook.com/selfxss |
This comment has been minimized.
This comment has been minimized.
I created a script that works with the new facebook layout: https://gist.github.com/michaelv/11145168 |
This comment has been minimized.
This comment has been minimized.
Babrath, can this script be tailored to dump out the blocked list? I need to clean it out as it's over 9k, and we can't tell if a member is messing with the current membership by deleting them, or blocking them indiscriminately. |
This comment has been minimized.
This comment has been minimized.
how do you run this on Mac Chrome?? Please help I need to delete two groups ASAP |
This comment has been minimized.
how to apply that on facebook ? I have my own group which have 8000+ members, i want to give new start for my group ! i want to demolish my old group ! can this script help me and how ? plz tell me step by step procedure