您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Remove unwanted buttons and sections on Twitter
当前为
- // ==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();
- })();