B站巨型网页模式摇杆

自动检测并修改 Bilibili 网页摇杆元素的样式

// ==UserScript==
// @name         B站巨型网页模式摇杆
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  自动检测并修改 Bilibili 网页摇杆元素的样式
// @author       无名可取的我真惨
// @match        https://live.bilibili.com/*
// @icon         https://www.bilibili.com/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const observer = new MutationObserver(() => {
        var gameElement = document.querySelector('#game-id');
        if (gameElement && gameElement.style.zIndex !== '1001') {
            gameElement.style.zIndex = '1001';
            console.log('动态检测到 #game-id 元素,z-index 修改为 1001');
        }

        var innerElement = document.querySelector('#game-id > div.ganme-id-interactive-game-bounce');
        if (innerElement) {
            innerElement.style.width = '90px';
            innerElement.style.height = '90px';
            console.log('动态检测到 #game-id > div.ganme-id-interactive-game-bounce 元素,width 和 height 修改为 90px');
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    console.log('脚本已启动,正在监听 DOM 变化...');
})();