Last active
January 3, 2025 13:27
-
-
Save nirgeier/7c3950db8f23e67b155a to your computer and use it in GitHub Desktop.
Revisions
-
nirgeier revised this gist
Jul 30, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,8 @@ var FBClearGroup = function() { removeLinks = Array.prototype.slice.call(document.querySelectorAll("a[href*='remove.php']")); // Verify that the previous step has completed // The -1 is the number of the admins in the gorup. if (removeLinks.length < memberSettings.length-1) { // wait for previous step to complete timer = setTimeout(openRemoveDialog, 1000); -
nirgeier created this gist
Jul 24, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,85 @@ /** * This script will delete all group members which are displayed in a given page. * * @author: Nir Geier * * Usage: * Load as many users as you need, then open console and paste this script in teh console. * Once the script finished executing you will be see blank members page, reload the next * page and start the process again. * * !!! Important * Sometimes after opening teh confirm dialog the page look "freeze" for a while * Its OK and it takes time to remove all users. * * If the page doen not return the members list page after few minutes, refresh the page and execute the script again */ var FBClearGroup = function() { // Get all the Admins settings buttons var memberSettings, removeLinks, timer; /** * This function will click on all the uses admin settings buttons to add the remove link to the page dom */ function exposeRemoveLinks() { memberSettings = Array.prototype.slice.call(document.querySelectorAll('.adminActions [role="button"]')); // Expose all the remove users links memberSettings.forEach(function(item) { item.click(); }); // continue with the delete flow timer = setTimeout(openRemoveDialog, 1000); } /** * This function will display the remove dialog */ function openRemoveDialog() { clearTimeout(timer); // Grab all the remove links removeLinks = Array.prototype.slice.call(document.querySelectorAll("a[href*='remove.php']")); // Verify that the previous step has completed if (removeLinks.length < memberSettings.length) { // wait for previous step to complete timer = setTimeout(openRemoveDialog, 1000); } else { // Open all the remove dialog removeLinks.forEach(function(item) { item.click(); }); // delete the users timer = setTimeout(removeUsers, 1000); } } /** * This method will click on the remove user and will remove the user form group */ function removeUsers() { // Grab all the confirm buttons var confirmButton = Array.prototype.slice.call(document.querySelectorAll('.layerConfirm.uiOverlayButton[type="submit"]')); // Verify that the previous step has completed if (confirmButton.length < memberSettings.length) { timer = setTimeout(removeUsers, 1000); } else { // Click on the remove confirm button confirmButton.forEach(function(item) { item.click(); }); } } exposeRemoveLinks(); }();