Lightweight X Plus

Performance tweaks with minimal UX impact

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Lightweight X Plus
// @namespace    lightweight-x-userscript
// @version      2.1
// @description  Performance tweaks with minimal UX impact
// @match        *://*.twitter.com/*
// @match        *://*.x.com/*
// @run-at       document-start
// @grant        none
// @license      GPLv3
// @author       Kdroidwin
// ==/UserScript==

(function () {
    'use strict';

    const style = document.createElement('style');
    style.textContent = `
        /* 1. ぼかし完全削除 */
        * {
            backdrop-filter: none !important;
        }

        /* 2. 透明レイヤー軽量化(濃度のみ調整) */
        header, nav, [role="dialog"] {
            background-color: rgba(0,0,0,0.85) !important;
        }

        /* 3. 重い影だけ削除(カード・モーダル系) */
        [role="dialog"],
        div[style*="box-shadow"],
        div[data-testid="card"] {
            box-shadow: none !important;
        }
    `;

    document.documentElement.appendChild(style);

    /* 4. 動画自動再生停止(手動再生は可能) */
    document.addEventListener("play", function (e) {
        const v = e.target;
        if (v.tagName === "VIDEO" && !v.paused) {
            v.pause();
        }
    }, true);

})();