Skip to content

Instantly share code, notes, and snippets.

@RFS-ADRENO
Last active November 12, 2024 01:14
Show Gist options
  • Select an option

  • Save RFS-ADRENO/8f6a0bc76fb347725a030b3babefd1ef to your computer and use it in GitHub Desktop.

Select an option

Save RFS-ADRENO/8f6a0bc76fb347725a030b3babefd1ef to your computer and use it in GitHub Desktop.
let selectAll = document.querySelector("[aria-label=\"Select all\"]") || document.querySelector("[aria-label=\"Chọn tất cả\"]");
let decline = document.querySelector("[aria-label=\"Decline\"]") || document.querySelector("[aria-label=\"Từ chối\"]");
let getDone = () => document.querySelector("[aria-label=\"Done\"]") || document.querySelector("[aria-label=\"Xong\"]");
let postContainer = document.querySelector(".xamitd3.xw7yly9.x193iq5w.x1xfsgkm.xqmdsaz.xvue9z.xq1tmr.x1ceravr");
let sleep = (ms) => new Promise(res => setTimeout(res, ms));
async function main() {
if (!selectAll || !decline) return;
if (getDone() != null || selectAll.getAttribute("aria-disabled") == "true") {
await sleep(500);
return main();
}
for (let i = 0; i < 5; i++) {
scroll();
await sleep(1000);
}
selectAll.click();
await sleep(500);
decline.click();
await sleep(500);
getDone().click();
main();
}
function scroll() {
window.scrollBy(0,postContainer.clientHeight);
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment