Skip to content

Instantly share code, notes, and snippets.

@attakei
Last active July 8, 2022 10:12
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 attakei/dd49ff80ccf7923da3ac1e48f92e3d94 to your computer and use it in GitHub Desktop.
Save attakei/dd49ff80ccf7923da3ac1e48f92e3d94 to your computer and use it in GitHub Desktop.
UserScript to hide timeline-trend of side-bar on Twitter
// ==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