Skip to content

Instantly share code, notes, and snippets.

@JoshuaKGoldberg
Created April 3, 2023 02:05
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 JoshuaKGoldberg/87a4e7fce4a649193b4d6e01e0acd1ca to your computer and use it in GitHub Desktop.
Save JoshuaKGoldberg/87a4e7fce4a649193b4d6e01e0acd1ca to your computer and use it in GitHub Desktop.
Unfollow current page
// Yes, I know this is super hacky! Don't worry about it.
// In theory we could use mutation observers to check for new elements...
// ...but this worked well enough. 😄
// Used as a script with the Run JavaScript extension:
// https://ataiva.com/run-javascript-chrome-extension-help
async function wait(seconds) {
await new Promise((resolve) => setTimeout(resolve, seconds));
}
for (let i = 0; i < 10; i += 1) {
(async () => {
await wait(550);
let retry = [...document.querySelectorAll(`div[role="button"]`)].find(
(b) => b.textContent === "Retry"
);
if (retry) {
retry.click();
await wait(250);
}
document.querySelector(`[aria-label*="Following @"]`).click();
await wait(250);
document.querySelector(`[data-testid="confirmationSheetConfirm"]`).click();
await wait(250);
window.close();
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment