Greasy Fork is available in English.

隐藏B站直播网页全屏聊天

隐藏网页全屏时右侧烦躁的聊天窗口,最好用较新一点的浏览器

// ==UserScript==
// @name         隐藏B站直播网页全屏聊天
// @description  隐藏网页全屏时右侧烦躁的聊天窗口,最好用较新一点的浏览器
// @license      MIT
// @grant        GM_addStyle
// @version      1.2
// @author       yinghuaile
// @match        https://live.bilibili.com/*
// @namespace yinghuaile
// ==/UserScript==

(function () {
    var body = document.body;
    var rightBar
    var findRightBarTimer
    var findRightBar = function () {
        rightBar = document.querySelector("#aside-area-vm");
        if (rightBar != null) {
            GM_addStyle(".player-full-win .player-section{width:100% !important;}");
            clearInterval(findRightBarTimer);
        }
    };

    findRightBarTimer = setInterval(findRightBar, 1000);

    var testObserver = new MutationObserver(function (mutations) {
        try {
            if(rightBar == null){
                return
            }
            //new Blob([l]).size
            let classLength = body.className.replace(/\s/g,"").length
            if (classLength <= 22) {
                rightBar.style.display = "block";
            } else {
                rightBar.style.display = "none";
            }
        } catch (error) {
            console.log(error)
        }
    });
    testObserver.observe(body, {
        attributeFilter: ["class"],
    });
})();