B站视频页 - 视频合集样式

修改新版视频页的视频合集样式

目前為 2024-10-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name         B站视频页 - 视频合集样式
// @namespace    mscststs
// @version      0.3
// @license      ISC
// @description  修改新版视频页的视频合集样式
// @author       mscststs
// @match        https://www.bilibili.com/video/*
// @icon         https://www.bilibili.com/favicon.ico
// @require      https://gf.qytechs.cn/scripts/38220-mscststs-tools/code/MSCSTSTS-TOOLS.js?version=713767
// @run-at       document-body
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    StartVideoCollection();
    async function StartVideoCollection(){

        await mscststs.wait(".video-pod .video-pod__header .header-bottom .right .subscribe-btn");
        var article = document.querySelector("body");

        function setVideoCollection() {
            var subscribBtn = document.querySelector(".video-pod .video-pod__header .header-bottom .right .subscribe-btn");
            var videoPod = document.querySelector(".video-pod .video-pod__body");
            //alert(videoPod.style.maxHeight);
            var maxHeight = "205px";
            if(subscribBtn.innerHTML.indexOf("订阅") != -1 && videoPod.style.maxHeight != maxHeight){
                var title = document.querySelector(".video-pod .video-pod__header .header-top .left .title");
                title.style.cssText += "font-size:16px!important;";
                //var videoPod = document.querySelector(".video-pod .video-pod__body");
                videoPod.style.cssText += "max-height:"+maxHeight+"!important;";

                var titleTxts = document.querySelectorAll(".simple-base-item .title .title-txt");
                var statses = document.querySelectorAll(".simple-base-item .stats");
                var normals = document.querySelectorAll(".simple-base-item.normal");
                //var fontCSS = "font-size:14px; font-family:PingFang SC,HarmonyOS_Regular,Helvetica Neue,Microsoft YaHei,sans-serif;";
                var fontCSS = "font-size:13.5px;";
                for(var i = 0; i < titleTxts.length; i++) {
                    titleTxts[i].style.cssText += fontCSS;
                    statses[i].style.cssText += fontCSS;
                    //normals[i].style.margin = "0";
                }
            }
        }

        var options = { 'childList': true, 'attributes':true };
        const callback = function(mutationsList, observer) {
            setVideoCollection();
        };
        const observer = new MutationObserver(callback);
        observer.observe(article, options);
        setVideoCollection();
        var time = 500;
        for(var i = 0; i < 20; i++) {
            setTimeout(function() {
                setVideoCollection();
                //alert(123);
            }, time);
            time += 500;
        }

    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址