您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides Twitter Blue sections and fixes GIF issue
当前为
// ==UserScript== // @name Hide Twitter(X) Premium Sections // @namespace https://x.com/mirabella_777 // @version 1.0 // @description Hides Twitter Blue sections and fixes GIF issue // @author mirabella_777 // @match *://twitter.com/* // @match *://x.com/* // @grant none // @run-at document-idle // @license MIT // ==/UserScript== (function() { 'use strict'; let isEnabled = true; // Toggle state const premiumSelectors = [ '[data-testid="verified"]', // Blue check users '[aria-label="Verified"]', // Verified badge on profiles '[href="/i/verified-orgs-signup"]', // Verified organizations '[href="/i/premium_sign_up"]', // Verified organizations '[href="/jobs"]', // Jobs '[aria-label="Top Articles"]', // Twitter Blue 'Top Articles' 'a[href="/i/premium"]', // Premium tab on the left sidebar 'div[role="button"]:has(span)', // Some premium buttons 'div[aria-label="Timeline: Verified"]', // Verified timeline '.r-vacyoi > div:nth-child(3)', // Verified timeline 'div[aria-label="Subscribe to Premium"]', // Subscribe to Premium section ]; function hidePremiumContent() { if (!isEnabled) return; // Hide premium content premiumSelectors.forEach(selector => { document.querySelectorAll(selector).forEach(el => { el.style.display = 'none'; el.setAttribute('data-hidden-premium', 'true'); }); }); } function restorePremiumContent() { document.querySelectorAll('[data-hidden-premium]').forEach(el => { el.style.display = ''; el.removeAttribute('data-hidden-premium'); }); } function toggleScript() { isEnabled = !isEnabled; if (isEnabled) { hidePremiumContent(); } else { restorePremiumContent(); } updateToggleButton(); } function addToggleButton() { const sidebar = document.querySelector('nav[aria-label="Primary"]'); if (!sidebar || document.getElementById('togglePremiumBtn')) return; let toggleButton = document.createElement('button'); toggleButton.id = 'togglePremiumBtn'; toggleButton.innerText = isEnabled ? "Premium Hidden" : "Premium Visible"; toggleButton.style.cursor = 'pointer'; toggleButton.style.padding = '8px 16px'; // Match size of "Post" button toggleButton.style.margin = '10px 0'; toggleButton.style.borderRadius = '50px'; // Rounded corners like the "Post" button toggleButton.style.fontSize = '14px'; toggleButton.style.fontWeight = 'bold'; // Similar font weight as "Post" toggleButton.style.fontFamily = '"Helvetica Neue", Helvetica, Arial, sans-serif'; // Use X's font toggleButton.style.color = '#fff'; toggleButton.style.backgroundColor = '#1D9BF0'; // Match the "Post" button color toggleButton.style.border = '1px solid #1D9BF0'; // Border like "Post" toggleButton.style.display = 'inline-block'; toggleButton.style.textAlign = 'center'; toggleButton.style.boxSizing = 'border-box'; toggleButton.style.transition = 'background-color 0.2s ease'; // Smooth transition on hover toggleButton.onclick = toggleScript; // Hover effect (like the "Post" button) toggleButton.onmouseover = () => { toggleButton.style.backgroundColor = '#1A8CD8'; toggleButton.style.borderColor = '#1A8CD8'; }; toggleButton.onmouseout = () => { toggleButton.style.backgroundColor = '#1D9BF0'; toggleButton.style.borderColor = '#1D9BF0'; }; sidebar.appendChild(toggleButton); } function updateToggleButton() { const toggleButton = document.getElementById('togglePremiumBtn'); if (toggleButton) { toggleButton.innerText = isEnabled ? "Premium Hidden" : "Premium Visible"; } } // Ensure GIFs are never hidden function ensureGifVisibility() { document.querySelectorAll('video[aria-label="GIF"]')?.forEach(gif => { gif.style.visibility = 'visible'; // Make sure GIFs remain visible }); } document.addEventListener('DOMContentLoaded', () => { addToggleButton(); hidePremiumContent(); ensureGifVisibility(); // Ensure GIFs are visible on page load }); // Observe for dynamically loaded content or navigation changes const observer = new MutationObserver(() => { hidePremiumContent(); addToggleButton(); ensureGifVisibility(); // Ensure GIFs remain visible on navigation or new content }); observer.observe(document.body, { childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址