Created
November 14, 2018 09:31
-
-
Save scazzy/4fc82f2a15550d0ddb471f537e11ad16 to your computer and use it in GitHub Desktop.
Javascript code to delete all pending posts from Facebook group lazily/infinitely
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
/* | |
* Function to infinitely delete pending posts from a facebook group | |
* Execute this code in console on the facebook group page > pending posts | |
*/ | |
function deletePosts () { | |
var deleteButtons = document.querySelectorAll('a[role=button][ajaxify*=delete]') | |
deleteButtons.forEach( b => { | |
b.click() | |
}) | |
if(!deleteButtons.length) return; | |
var confirmButtons = document.querySelectorAll('button[data-testid=delete_post_confirm_button]') | |
setTimeout(() => { | |
confirmButtons.forEach( d => { | |
d.click() | |
}) | |
window.scrollTo(0, document.body.scrollHeight); | |
setTimeout(() => { | |
if(!confirmButtons.length) return; | |
delposts() | |
}, 10000) | |
}, 10000) | |
} | |
deletePosts(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment