Lightweight X Plus

Performance tweaks with minimal UX impact

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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

})();