Skip to content

Instantly share code, notes, and snippets.

@JoshuaCWebDeveloper
Last active April 4, 2024 18:35
Show Gist options
  • Save JoshuaCWebDeveloper/41cc5b667f7e428842a235dbe74c59f0 to your computer and use it in GitHub Desktop.
Save JoshuaCWebDeveloper/41cc5b667f7e428842a235dbe74c59f0 to your computer and use it in GitHub Desktop.
Hide Twitter Full Sidebar Trending
// ==UserScript==
// @name Hide Trending Articles
// @namespace http://tampermonkey.net/
// @version 2024-04-04
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
(function exec() {
'use strict';
try {
let parentElement = document.querySelector('[aria-label="Trending"]');
if (parentElement) {
parentElement.querySelectorAll('article').forEach((element) => {
element.parentElement.parentElement.style.display = 'none';
});
parentElement.querySelectorAll('svg').forEach((element) => {
element.parentElement.parentElement.parentElement.style.display = 'none';
});
}
}
catch (e) {
console.error(e);
}
setTimeout(exec, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment