Greasy Fork

Greasy Fork is available in English.

X/Twitter Wide Screen Optimization (X/推特宽屏优化)

Optimizes X.com and Twitter.com for large screens, increasing content area width and adjusting layout. (优化 X.com 和 Twitter.com 在大屏幕上的显示,增加内容区域宽度并调整布局。)

当前为 2025-06-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         X/Twitter Wide Screen Optimization (X/推特宽屏优化)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Optimizes X.com and Twitter.com for large screens, increasing content area width and adjusting layout. (优化 X.com 和 Twitter.com 在大屏幕上的显示,增加内容区域宽度并调整布局。)
// @author       vnry
// @match        https://x.com/*
// @match        https://twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=x.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const style = document.createElement('style');
    style.textContent = `
      @media (min-width: 1600px) {
        html, body {
          height: auto !important;
          min-height: 100vh !important;
          overflow-x: hidden !important;
          overflow-y: auto !important;
        }
        #react-root,
        #react-root > div:first-child,
        .css-175oi2r.r-1f2l425.r-13qz1uu.r-417010.r-18u37iz {
            width: 100% !important;
            max-width: unset !important;
            min-width: unset !important;
            flex: 1 1 auto !important;
            height: auto !important;
            min-height: 100vh !important;
            overflow: visible !important;
        }
        header[role='banner'] {
          flex-grow: 0 !important;
          width: 70px !important;
          min-width: 70px !important;
          max-width: 70px !important;
          flex-shrink: 0 !important;
        }
        header[role='banner'] > div:first-child {
            width: 100% !important;
            align-items: center !important;
        }
        nav[role='navigation'] a div[dir="ltr"] span.css-1jxf684.r-bcqeeo.r-1ttztb7.r-qvutc0.r-poiln3 {
            display: none !important;
        }
        nav[role='navigation'] > * > div:first-child > div[dir=auto]:last-child {
          display: none !important;
        }
        a[data-testid='SideNav_NewTweet_Button'] {
            width: 48px !important;
            min-width: 48px !important;
            height: 48px !important;
            min-height: 48px !important;
            padding: 0 !important;
            border-radius: 50% !important;
            display: flex !important;
            justify-content: center !important;
            align-items: center !important;
            background-color: rgb(29, 155, 240) !important;
            color: white !important;
        }
        a[data-testid='SideNav_NewTweet_Button'] span {
            display: none !important;
        }
        a[data-testid='SideNav_NewTweet_Button'] svg {
            display: block !important;
            width: 1.5em !important;
            height: 1.5em !important;
            fill: currentcolor !important;
        }
        div[data-testid='SideNav_AccountSwitcher_Button'] {
            padding: 4px !important;
        }
        div[data-testid='SideNav_AccountSwitcher_Button'] > div:nth-child(2),
        div[data-testid='SideNav_AccountSwitcher_Button'] > div:nth-child(3) {
            display: none !important;
        }
        main[role='main'] {
            width: 100% !important;
            flex-grow: 1 !important;
            flex-shrink: 1 !important;
            height: auto !important;
            min-height: 100% !important;
            overflow-y: visible !important;
            display: flex !important;
            flex-direction: column !important;
        }
        main[role='main'] > div:first-child {
            width: 100% !important;
            max-width: unset !important;
            margin: 0 !important;
            flex-grow: 1 !important;
            flex-shrink: 1 !important;
            height: auto !important;
            min-height: 100% !important;
            display: flex !important;
            flex-direction: row !important;
        }
        main[role='main'] > div:first-child > div:nth-child(2) > div:first-child {
            width: 100% !important;
            max-width: unset !important;
            margin: 0 !important;
            flex-grow: 1 !important;
            flex-shrink: 1 !important;
            height: auto !important;
            min-height: 100% !important;
        }
        [data-testid='primaryColumn'] {
            max-width: 1800px !important;
            width: 100% !important;
            flex-grow: 1 !important;
            flex-shrink: 1 !important;
            margin-left: auto !important;
            margin-right: auto !important;
            border-left: none !important;
            border-right: none !important;
            height: auto !important;
            min-height: 100% !important;
            overflow-y: visible !important;
        }
        article[data-testid="tweet"] .r-1ets6dv.r-1phboty.r-rs99b7.r-1867qdf.r-1udh08x,
        article[data-testid="tweet"] .r-1ets6dv.r-1phboty.r-rs99b7.r-1867qdf.r-1udh08x a,
        article[data-testid="tweet"] .r-1ets6dv.r-1phboty.r-rs99b7.r-1867qdf.r-1udh08x > div:first-child > div:first-child {
            width: 100% !important;
            max-width: 100% !important;
            height: auto !important;
        }
        article[data-testid="tweet"] .r-1ets6dv.r-1phboty.r-rs99b7.r-1867qdf.r-1udh08x img {
            width: 100% !important;
            height: auto !important;
            object-fit: contain !important;
        }
        [data-testid='primaryColumn'] > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child {
            max-width: 100% !important;
            width: 100% !important;
            margin: auto !important;
        }
        [data-testid='primaryColumn'] > div:first-child > div:last-child {
            width: 95% !important;
            max-width: unset !important;
            margin: auto !important;
        }
        [data-testid='sidebarColumn'] {
            width: 300px !important;
            max-width: 300px !important;
            flex-grow: 0 !important;
            flex-shrink: 0 !important;
            margin-left: 20px !important;
            height: auto !important;
            min-height: 100% !important;
            overflow-y: visible !important;
        }
        [data-testid='sidebarColumn'] > div:first-child > div:last-child,
        [data-testid='sidebarColumn'] > div:first-child > div:last-child > div:first-child > div:first-child > div:first-child > div:first-child {
            width: 100% !important;
        }
        .css-175oi2r.r-1xpp3t0 {
            width: 100% !important;
            max-width: unset !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
        }
        .css-175oi2r.r-f8sm7e.r-13qz1uu.r-1ye8kvj {
            max-width: 1800px !important;
            width: 100% !important;
            margin-left: auto !important;
            margin-right: auto !important;
            height: auto !important;
            min-height: 100% !important;
            overflow-y: visible !important;
        }
        [aria-labelledby='master-header'] {
            max-width: 100% !important;
            margin: 0 !important;
            width: 250px !important;
            flex-shrink: 0 !important;
            flex-grow: 0 !important;
        }
        [aria-labelledby='detail-header'] {
            width: auto !important;
            max-width: 100% !important;
            margin: 0 !important;
            flex-grow: 1 !important;
        }
        [aria-labelledby='detail-header'] > div:nth-child(2) > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:nth-child(2),
        [aria-labelledby='detail-header'] > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child {
            width: 90% !important;
            max-width: 90% !important;
            margin: auto !important;
        }
        [role='main'] > div:first-child > div:first-child > div:first-child {
          max-width: 100% !important;
        }
        [data-testid='primaryColumn'] > div:first-child > div:first-child > div:last-child > div:first-child > div:last-child {
          width: 95% !important;
          max-width: unset !important;
          margin: auto !important;
        }
      }
    `;
    document.head.appendChild(style);
})();