Skip to content

Instantly share code, notes, and snippets.

@f
Created January 22, 2023 21:28
Show Gist options
  • Save f/ed5a574ef17768b740b017d650098739 to your computer and use it in GitHub Desktop.
Save f/ed5a574ef17768b740b017d650098739 to your computer and use it in GitHub Desktop.
Twitter Arc Boost
const $$ = document.querySelectorAll.bind(document);
const $ = document.querySelector.bind(document);
const watchBody = new MutationObserver(() => {
const tabs = `[href='/home'][role='tab']`;
const homeButton = `[aria-label="Home"]`;
const $tabs = $$(tabs);
if ($tabs?.length > 1) {
$tabs[1]?.click();
$(homeButton).addEventListener('click', () => {
setTimeout(() => $$(tabs)?.[1].click());
})
watchBody.disconnect();
}
});
watchBody.observe(document.body, {
childList: true,
subtree: true,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment