Last active
July 8, 2022 10:12
-
-
Save attakei/dd49ff80ccf7923da3ac1e48f92e3d94 to your computer and use it in GitHub Desktop.
UserScript to hide timeline-trend of side-bar on Twitter
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
// ==UserScript== | |
// @name Hide sidebar | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide sidebar of Twitter | |
// @author attakei | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var done = false; | |
const hideIt = () => { | |
const sidebarComponents = Array.from(document.getElementsByTagName("div")).filter(elm => elm.hasAttribute("aria-label") && elm.getAttribute("aria-label") === "タイムライン: トレンド"); | |
if (sidebarComponents.length > 0) { | |
sidebarComponents[0].children[0].setAttribute("style", "display:none;"); | |
done = true; | |
} | |
if (!done) setInterval(hideIt, 1000); | |
}; | |
setInterval(hideIt, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment