X Repost and Reply Remover (Enhanced)

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

目前为 2024-09-19 提交的版本。查看 最新版本

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址