B站顶部栏 - 旧版隐藏左动态栏

隐藏顶部栏左边动态栏

// ==UserScript==
// @name         B站顶部栏 - 旧版隐藏左动态栏
// @namespace    mscststs
// @version      0.4
// @license      ISC
// @description  隐藏顶部栏左边动态栏
// @author       mscststs
// @match        https://*.bilibili.com/*
// @icon         https://www.bilibili.com/favicon.ico
// @require      https://greasyfork.org/scripts/38220-mscststs-tools/code/MSCSTSTS-TOOLS.js?version=713767
// @run-at       document-body
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var url = document.URL;
    if(!(url.startsWith("https://space.bilibili.com/") || url.startsWith("https://www.bilibili.com/v/"))) {
        StartNavLink();
        async function StartNavLink(){

            await mscststs.wait(".nav-link .nav-link-ul .nav-link-item");
            var article = document.querySelector("body");

            function setNavLink() {
                var navLinks = document.querySelectorAll(".nav-link .nav-link-ul .nav-link-item");
                //alert(navLinks.length);
                if(navLinks.length == 10) {
                    navLinks[7].style.display = "none";
                    navLinks[8].style.display = "none";
                } else if(navLinks.length == 9) {
                    navLinks[7].style.display = "none";
                }
            }

            var options = { 'childList': true, 'attributes':true };
            const callback = function(mutationsList, observer) {
                setNavLink();
            };
            const observer = new MutationObserver(callback);
            observer.observe(article, options);
            setNavLink();

        }
    }
})();