Completely hide all replies, including self-replies and threads, on X.com
当前为
// ==UserScript==
// @name Hide All Replies and Threads on X.com
// @namespace http://tampermonkey.net/
// @version 1.8
// @description Completely hide all replies, including self-replies and threads, on X.com
// @author
// @match https://x.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const tweetSelector = '[data-testid="cellInnerDiv"]';
const replySelector = '[aria-label^="Replying to"]'; // Targets replies, self-replies, and threads
function hideRepliesAndThreads() {
const tweets = document.querySelectorAll(tweetSelector);
tweets.forEach((tweet) => {
const isReply = tweet.querySelector(replySelector);
if (isReply) {
tweet.style.display = 'none';
console.debug('Hid a reply, self-reply, or thread.');
}
});
}
// Observes DOM changes and applies the hiding function dynamically
const observer = new MutationObserver(hideRepliesAndThreads);
observer.observe(document.body, { childList: true, subtree: true });
// Initial run to hide existing replies/threads
hideRepliesAndThreads();
})();