// ==UserScript== // @name b站收藏夹优化 // @namespace http://tampermonkey.net/ // @version 1.0.5 // @description 缩小收藏夹,关注列表的间距 // @author aotmd // @match https://*.bilibili.com/* // @grant none // @downloadURL none // ==/UserScript== (function () { addLoadEvent(() => { window.setTimeout(() => { }, 1000); }); addStyle(` /*视频页选择收藏夹页面*/ .collection-m .content .group-list li { padding-bottom: 0px!important; } /*顶栏下拉菜单*/ .v-dropdown .dropdown-menu li { padding: 0px 16px!important; text-align: left!important; } /*我的收藏页面*/ #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.router-link-active { 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; } `); /** * 添加浏览器执行事件 * @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)); } })();