Skip to content

Instantly share code, notes, and snippets.

@Garciat
Last active August 27, 2019 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garciat/ee460dd418d963e71fdfe573496e3a63 to your computer and use it in GitHub Desktop.
Save Garciat/ee460dd418d963e71fdfe573496e3a63 to your computer and use it in GitHub Desktop.
function delay(n) {
return new Promise(accept => setTimeout(() => accept(), n));
}
async function cleanUp() {
let xs = Array.from(document.querySelectorAll('[aria-label=Edit]')).slice(0, 10);
console.log(xs);
xs.forEach(n => n.click());
await delay(1000);
let ys = document.querySelectorAll('[rel=async-post][ajaxify^="/ajax/timeline/delete/confirm"]');
console.log(ys);
ys.forEach(n => n.click());
await delay(5000);
for (let n of document.querySelectorAll('form[action^="/ajax/timeline/delete"] [type=submit]')) {
n.click();
await delay(500);
}
for (let x of xs) {
document.querySelector(`[data-ownerid=${x.id}]`).remove();
x.remove();
}
document.querySelectorAll('.uiLayer').forEach(n => n.remove());
window.scrollTo(0, document.body.scrollHeight);
await delay(1000);
let loader = document.querySelector('[ajaxify^="/ajax/timeline/all_activity/scroll.php"]');
if (loader) loader.click();
await delay(1000);
await cleanUp();
}
cleanUp();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment