Greasy Fork is available in English.

b站收藏夹优化

缩小收藏夹,关注列表的间距

// ==UserScript==
// @name         b站收藏夹优化
// @namespace    http://tampermonkey.net/
// @version      1.1.3
// @description  缩小收藏夹,关注列表的间距
// @author       aotmd
// @match        https://*.bilibili.com/*
// @exclude      https://live.bilibili.com/p/html/live-fansmedal-wall/*
// @grant        none
// ==/UserScript==

(function () {
    addLoadEvent(() => {
        window.setTimeout(() => {

        }, 1000);
    });

    addStyle(`
    /*视频页选择收藏夹页面*/
    .collection-m .content .group-list li {
        padding-bottom: 0px!important;
    }
    /*新版播放列表*/
    .collection-m-exp .content .group-list li {
        padding-bottom: 0px;
    }
    .collection-m-exp ul {
        line-height: 1!important;
    }

    /*顶栏下拉菜单*/
    .be-dropdown .dropdown-popup .bex-dropdown-item {
        justify-content: flex-start!important;
    }
    .dropdown-popup .bex-dropdown-item {
        line-height: normal;
        padding: 0px 16px!important;
        text-align: left!important;
    }
    /*有两个版本*/
    .v-dropdown .dropdown-menu li {
    text-align: left;
    padding: 0px 16px;
    }



    /*我的收藏页面*/
    #page-fav .fav-sidenav .text {
        line-height: normal!important;
    }
    .be-dropdown-trigger {
        height: 20px!important;
    }
    /*弹出菜单位置偏移修复*/
    ul.be-dropdown-menu.menu-align- {
        margin-top: -10px;
    }
    /*收藏夹列表全部显示*/
    #page-fav .fav-sidenav .fav-list-container {
        max-height: none!important;
    }
    /*收藏页面的改变收藏夹列表间距*/
    .wrapper .edit-video-modal .target-favlist .target-favitem {
        height: auto!important;
        margin-bottom: 0px!important;
    }
    /*左右浮动,将两个p标签合并为一行*/
    p.fav-state {
        margin-left: 10px;
        float: right;
    }
    p.fav-name {
        float: left;
    }
    /*文字尽量显示出来*/
    #page-fav .fav-sidenav .text {
        text-overflow: clip;
    }
    a.text {
    overflow: visible!important;
}
    /*也缩小关注页间距和全部显示*/
    .follow-item a.text {
        line-height: inherit!important;
    }
    .be-scrollbar.follow-list-container.ps {
        max-height: inherit!important;
    }
    .follow-dialog-wrap .follow-dialog-window .content .group-list li {
        padding-bottom: 0px!important;
    }
    .group-list {
        max-height: inherit!important;
    }
    #app .follow-dialog-wrap-exp .follow-dialog-window .content .group-list li {
    padding-bottom: 0px;
    }
    /*压缩列表间距*/
    #page-follows .list-item .content {
        margin-top: 0px!important;
    }
    .list-item {
        padding: 5px 0!important;
    }
    .list-item .title {
        height: auto!important;
    }

    `);

    /**
     * 添加浏览器执行事件
     * @param func 无参匿名函数
     */
    function addLoadEvent(func) {
        let oldOnload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function () {
                try {
                    oldOnload();
                } catch (e) {
                    console.log(e);
                } finally {
                    func();
                }
            }
        }
    }

    //添加css样式
    function addStyle(rules) {
        let styleElement = document.createElement('style');
        styleElement["type"] = 'text/css';
        document.getElementsByTagName('head')[0].appendChild(styleElement);
        styleElement.appendChild(document.createTextNode(rules));
    }
})();