Skip to content

Instantly share code, notes, and snippets.

@OriginalJef
Last active February 24, 2022 21:00
Show Gist options
  • Save OriginalJef/83381ed15437fc396b27dfc871f48cb8 to your computer and use it in GitHub Desktop.
Save OriginalJef/83381ed15437fc396b27dfc871f48cb8 to your computer and use it in GitHub Desktop.
How to decline all Facebook page like requests at once

How to decline all Facebook page like requests at once

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 :

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();
@SAFAD
Copy link

SAFAD commented Feb 24, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment