If you want to do cleaning on your Facebook, you may want to decline all Facebook page like requests quickly. There is a way for that :
- Go to https://www.facebook.com/pages/?category=invites&ref=bookmarks
- open console and execute the code below.
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function find_confirm() {
if ([].slice.call(document.querySelectorAll('[aria-label="Confirm"]'))) {
[].slice
.call(document.querySelectorAll('[aria-label="Confirm"]'))[1]
.click();
await sleep(1000);
}
}
async function find_decline() {
if ([].slice.call(document.querySelectorAll('[role="menuitem"]'))) {
[].slice.call(document.querySelectorAll('[role="menuitem"]'))[2].click();
await sleep(1000);
await find_confirm();
}
}
async function handleClick(x) {
x.click();
await sleep(1000);
await find_decline();
}
async function decline_all() {
var data = [].slice.call(document.querySelectorAll('[aria-label="More"]'));
for (let index = 1; index < data.length; index++) {
const row = data[index];
await handleClick(row);
}
}
decline_all();
- Also want a simple way to unlike all Facebook pages: https://gist.github.com/philippebarbosa/8454475
Good script!
Changed above script a little bit to unlike all liked FB pages: