Created
November 2, 2022 08:43
-
-
Save mogery/b0808762c2fffe5ec4d430d5cf216d45 to your computer and use it in GitHub Desktop.
View Latest Tweets (Tampermonkey Userscript)
This file contains 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
// ==UserScript== | |
// @name View Latest Tweets | |
// @namespace https://mogery.me/ | |
// @version 1.0 | |
// @description Automatically switches Twitter timeline to Latest Tweets. | |
// @author mogery | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.onload = () => { | |
console.log("[WLT] Checking for button..."); | |
let topBtn = document.querySelector('div[aria-label="Top Tweets on"]'); | |
if (topBtn) { | |
console.log("[WLT] Button found!"); | |
topBtn.click(); | |
setTimeout(() => { | |
document.querySelector('div[data-testid="Dropdown"]').children[1].click(); | |
}, 100); | |
} else console.warn("[WLT] Button not found."); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment