Remove_Live

去除B站多余的直播播放器^^

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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         Remove_Live
// @name:zh-CN   去除B站直播间播放器
// @namespace    https://github.com/Zhihui412
// @version      2.0
// @description  去除B站多余的直播播放器^^
// @author       hiuzh
// @include      https://live.bilibili.com/*
// @license      AGPL-3.0
// @icon         https://www.google.com/s2/favicons?sz=64&domain=git-scm.com
// ==/UserScript==

(() => {
    "use strict";
    let isRemove = false;

    // 定义创建按钮
    let btn = document.createElement("button");
    btn.id = "removeLive";
    btn.textContent = isRemove ? "恢复播放器" : "移除播放器";

    // 获取dom元素,插入按钮
    let btnArea = document.querySelector(".right-ctnr");
    btnArea.insertBefore(btn, btnArea.children[0]);

    // 给按钮添加点击事件
    btn.addEventListener("click", () => {
        // 取反
        isRemove = !isRemove;
        window.localStorage.setItem("isRemove", isRemove);
        btn.textContent = isRemove ? "恢复播放器" : "移除播放器";
        if (isRemove) {
            // 移除直播间播放器            
            document.getElementById("live-player").remove();
        } else {
            // 否则重新加载页面
            window.location.reload();
        }
    });
})();