Twitter UI Cleanup

Remove unwanted buttons and sections on Twitter

目前为 2025-01-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Twitter UI Cleanup
// @namespace    https://github.com/Daminator4113/Twitter-UI-Cleanup
// @version      1.0
// @author       Daminator4113
// @description  Remove unwanted buttons and sections on Twitter
// @license      MIT
// @icon         https://abs.twimg.com/favicons/twitter.2.ico
// @match        https://twitter.com/*
// @match        https://x.com/*
// ==/UserScript==

(function() {
    'use strict';

    const removeElements = () => {
        const selectors = [
            'a[href*="/i/grok"]', // Grok
            'a[href*="/i/premium_sign_up"]', // Twitter Blue
            'a[href*="/i/verified-orgs-signup"]', // Verified organizations
            'button[data-testid="grokImgGen"]' // "Generate Image with Grok" button
        ];

        const premiumLinkContainer = document.querySelector('aside a[href*="/i/premium_sign_up"]')?.closest('div')?.parentElement; // "Try Premium for free" section
        if (premiumLinkContainer?.tagName === 'DIV') {
            premiumLinkContainer.remove();
        }

        selectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => el.remove());
        });
    };

    const observer = new MutationObserver(() => {
        removeElements();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    removeElements();
})();

QingJ © 2025

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