X Repost, Reply, and Thread Remover (Enhanced)

Hide reposts, replies, and threads on X.com timeline with advanced techniques

当前为 2024-09-19 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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();
})();