B站视频动态评论显示楼层数

叔叔我啊

当前为 2021-11-10 提交的版本,查看 最新版本

// ==UserScript==
// @name         B站视频动态评论显示楼层数
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  叔叔我啊
// @author       Hanayo
// @match        https://www.bilibili.com/video*
// @match        https://t.bilibili.com/*
// @icon         https://www.google.com/s2/favicons?domain=bilibili.com
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    const btn = `<button style='width: 30px;
    height: 100px;
    margin: 0 auto;
    line-height: 20px;
    background-color: #FB7299;
    position: fixed;
    top: 50%;
    right: 10px;
    color: white;
    font-size: 14px;
    border: 2px solid #FB7299;
    border-radius: 5px;
    cursor:pointer'
    id="getFloor">获取楼层</button>`
    const addBtn = $("body")
    $(addBtn).append(btn)
    $("#getFloor").click(function(){
        getAll()
    });
    function getAll(){
        let get = setInterval(()=>{
            const ele_height = document.getElementById("app").offsetHeight
            const loading = $(".loading-state").text()
            scrollBy(0,ele_height);
            if(loading){
                scrollBy(0,ele_height);
                $(window).scrollTop($('.comment-header').offset().top-50)
                printFloor()
                clearInterval(get)
            }
        },1000)
        }
    function printFloor(){
        const list = $(".comment-list").children().each(function(index,element){
            const temp = `<span style='margin-left: 20px;'>楼层:${index+1}</span>`
            $(this).children(".con").children(".user").append(temp)
        })
        }
})();

QingJ © 2025

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