x.com DEMO mode

Blur usernames and IDs on X.com for DEMO mode, with hover to reveal or hide

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name       x.com DEMO mode
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Blur usernames and IDs on X.com for DEMO mode, with hover to reveal or hide
// @author       Grok & https://x.com/scavenger869
// @match        https://x.com/*
// @grant        GM_addStyle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 添加CSS样式,控制模糊和悬浮效果
    GM_addStyle(`
        /* 默认模糊效果 */
        button[data-testid="SideNav_AccountSwitcher_Button"] > div:nth-child(2) {
            filter: blur(5px);
            transition: filter 0.3s ease; /* 平滑过渡效果 */
        }

        /* 选项1:鼠标悬浮时移除模糊效果 */
        button[data-testid="SideNav_AccountSwitcher_Button"] > div:nth-child(2):hover {
            filter: blur(0);
        }

        /* 选项2:鼠标悬浮时隐藏元素(注释掉选项1后启用) */
        /*
        button[data-testid="SideNav_AccountSwitcher_Button"] > div:nth-child(2):hover {
            display: none;
        }
        */
    `);

    // 函数:确保元素被正确处理(如果需要额外的JavaScript逻辑)
    function applyBlur() {
        const usernameElements = document.querySelectorAll('button[data-testid="SideNav_AccountSwitcher_Button"] > div:nth-child(2)');
        usernameElements.forEach(element => {
            // 确保元素有模糊效果(CSS已处理,这里可以留空)
            // 如果需要额外的JavaScript逻辑,可以在这里添加
        });
    }

    // 初次运行
    applyBlur();

    // 使用MutationObserver监听页面变化
    const observer = new MutationObserver((mutations) => {
        mutations.forEach(() => {
            applyBlur(); // 每次页面有变化时重新处理
        });
    });

    // 观察整个文档的变化
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();