B站主页清理助手

清理掉主页无用内容

// ==UserScript==
// @name         B站主页清理助手
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  清理掉主页无用内容
// @author       Zszen
// @match        https://www.bilibili.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    hiddenEL_CLS("extension","rank-list","manga-rank","pgc-rank","home-slide","bypb-window");
    //hiddenEL("rank-list");
    //hiddenEL("manga-rank");
    //hiddenEL("pgc-rank");
    //hiddenEL("home-slide");
    //hiddenEL("bypb-window");
    //hiddenEL("report-scroll-module");
    hiddenEL_TAG("iframe");
    widthEL_CLS("bili-banner","first-screen");

    function hiddenEL_CLS(...className){
        for(var i=0;i<className.length;i++){
            document.getElementsByClassName(className[i]).forEach((el)=>{
                el.style.display = "none";
                el.style.width = "0px";
            });
        }
    }
    function hiddenEL_TAG(...tagName){
        for(var i=0;i<tagname.length;i++){
            document.getElementsByTagName(tagname[i]).forEach((el)=>{
                el.style.display = "none";
                el.style.width = "0px";
            });
        }
    }

    function widthEL_CLS(...className){
        for(var i=0;i<className.length;i++){
            document.getElementsByClassName(className[i]).forEach((el)=>{
                el.style.minWidth = "100%";
                el.style.width = "100%";
            });
        }
    }
    // Your code here...
})();