Greasy Fork is available in English.
Hide reposts and replies on X.com timeline with advanced techniques
当前为
// ==UserScript==
// @name X Repost and Reply Remover (Enhanced)
// @namespace https://x.com/
// @version 2.7
// @description Hide reposts and replies on X.com timeline with advanced techniques
// @author
// @match https://twitter.com/*
// @match https://x.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function hideRepliesAndReposts() {
var tweets = document.querySelectorAll('article');
tweets.forEach(tweet => {
// Check for replies or reposts by looking for elements with data-testid="socialContext"
var socialContext = tweet.querySelector('[data-testid="socialContext"]');
if (socialContext) {
tweet.style.display = 'none';
}
});
}
// Observe dynamic content loading
const observer = new MutationObserver(() => {
hideRepliesAndReposts();
});
observer.observe(document.body, { childList: true, subtree: true });
// Initial call
hideRepliesAndReposts();
})();