Lightweight X Plus

Performance tweaks with minimal UX impact

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);

})();