Created
March 4, 2017 15:39
-
-
Save htdat/2e9a1229eccbf97c58cb48fbcce08384 to your computer and use it in GitHub Desktop.
Delete FB group pending posts for admins
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
/** | |
* Please use this file at your own risk. I don't provide the support for it. | |
* Any suggestion or problem are welcomed to report here :) | |
*/ | |
/** | |
* Usage: | |
* 1. Log-in as an group admin in the desktop | |
* 2. Go to your group pending list like: https://www.facebook.com/groups/[group-id]/pending/ | |
* 3. Insert the following code to your browser console. See the guide: https://developer.chrome.com/devtools/docs/console | |
* | |
* Note: | |
* - This will delete all posts in your pending list, so please make sure you don't need them any more. | |
*/ | |
var count_del = 0; | |
var count_confirm = 0; | |
var click_del = function () { | |
//button 'x' delete, class: img sp_WVlmwZ4PzbP sx_8019e2 | img sp_vPWoN8_ZzE7 sx_5cd324 | img sp_uBI2xAARzhd sx_812cfb | img sp_P3HKPeqx6sL sx_f56b15 | |
var inputs_del = document.getElementsByClassName('img sp_WVlmwZ4PzbP sx_8019e2'); | |
for(var i=0; i<inputs_del.length;i++) { | |
if ( i == 10) { break; }; | |
count_del++; | |
console.log("Click Delete " + count_del); | |
inputs_del[i].click(); | |
}; | |
}; | |
var click_confirm = function () { | |
//button 'Delete' to confirm delete this post | |
var inputs_confirm = document.getElementsByClassName('_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy'); | |
for(var i=0; i<inputs_confirm.length;i++) { | |
if ( i == 10) { break; }; | |
count_confirm++; | |
inputs_confirm[i].click(); | |
console.log("Click Confirm " + count_confirm); | |
}; | |
}; | |
var click_ok = function () { | |
//button 'Okay' when a post was deleted already | |
var inputs_confirm = document.getElementsByClassName('_42ft _4jy0 layerCancel uiOverlayButton _4jy3 _4jy1 selected _51sy'); | |
for(var i=0; i<inputs_confirm.length;i++) { | |
if ( i == 10) { break; }; | |
inputs_confirm[i].click(); | |
console.log("Click OK "); | |
}; | |
}; | |
var interval_del = setInterval( function () { click_del() }, 8000); | |
var interval_confirm = setInterval( function () { click_confirm() }, 3000); | |
var interval_ok = setInterval( function () { click_ok() }, 8000); | |
//clearInterval(interval_ok); | |
//automatically scroll down to the bottom of page - ref: http://bit.ly/1O4tvHd | |
var interval_bottom_page = setInterval( function () { window.scrollTo(0,document.body.scrollHeight) }, 30000); ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vijay