Hide reposts, replies, and threads on X.com timeline with advanced techniques
当前为
// ==UserScript==
// @name X Repost, Reply, and Thread Remover (Enhanced)
// @namespace https://x.com/
// @version 2.8
// @description Hide reposts, replies, and threads on X.com timeline with advanced techniques
// @match https://twitter.com/*
// @match https://x.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function hideUnwantedTweets() {
var tweets = document.querySelectorAll('article');
tweets.forEach(tweet => {
// Check for reposts
var isRepost = tweet.querySelector('[data-testid="socialContext"]');
// Phrases to detect replies and threads in different languages
var replyPhrases = ['Replying to', 'Respondiendo a', 'Répondre à', 'Antwort an', 'Rispondendo a', 'Responder a'];
var threadPhrases = ['Show this thread', 'Mostrar este hilo', 'Afficher ce fil', 'Diesen Thread anzeigen', 'Mostra questo thread'];
// Check for replies
var isReply = replyPhrases.some(phrase => tweet.innerText.includes(phrase));
// Check for threads
var isThread = threadPhrases.some(phrase => tweet.innerText.includes(phrase));
if (isRepost || isReply || isThread) {
tweet.style.display = 'none';
}
});
}
// Observe dynamic content loading
const observer = new MutationObserver(() => {
hideUnwantedTweets();
});
observer.observe(document.body, { childList: true, subtree: true });
// Initial call
hideUnwantedTweets();
})();