Created
April 3, 2023 02:05
-
-
Save JoshuaKGoldberg/87a4e7fce4a649193b4d6e01e0acd1ca to your computer and use it in GitHub Desktop.
Unfollow current page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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