Greasy Fork

Greasy Fork is available in English.

哔哩哔哩(B站)评论区显示楼层

(2022/10可用)bilibili哔哩哔哩网页端视频、番剧、动态等页面显示评论区楼层与楼中楼楼层,理论兼容Bilibill Evolved

当前为 2022-10-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         哔哩哔哩(B站)评论区显示楼层
// @description  (2022/10可用)bilibili哔哩哔哩网页端视频、番剧、动态等页面显示评论区楼层与楼中楼楼层,理论兼容Bilibill Evolved
// @author       lchzh3473 , Modify by Tinhone
// @namespace    Original by lchzh3473 , Modify by Tinhone
// @license      GPL-3.0
// @version      1.8.7
// @icon         https://app.bilibili.com/favicon.ico
// @grant        none
// @compatible   firefox V84+
// @compatible   edge V88+
// @compatible   chrome V88+
// @match        *://www.bilibili.com/video/*
// @match        *://www.bilibili.com/read/cv*
// @match        *://www.bilibili.com/bangumi/play/*
// @match        *://t.bilibili.com/*
// @match        *://space.bilibili.com/*
// @match        *://workshop.bilibili.com/illust/*
// @match        *://workshop.bilibili.com/live2d/*
// @exclude      *://t.bilibili.com/
// @run-at       document-end
// ==/UserScript==

(function() {
    //代码看起来长,实际上只是一个功能对于几个页面的分别适配,看if (whichPage=="0")这一段就可以大概理解整个脚本了(~ ̄▽ ̄)~
    'use strict';
    const oldVideoPage=".comment-m .common .b-head" //旧版视频页特征
    const newVideoPageV1="body.harmony-font.header-v2.win.always-show-duration div#app.app-v1 div.video-container-v1 div.left-container div.left-container-under-player div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title li.nav-title-text" //新版视频页版本一特征 //版本特性为不可使用楼中楼楼层、旧页面
    const newVideoPageV2="body.harmony-font.header-v2.win:not(.always-show-duration) div#app.app-v1" //新版视频页版本二特征 //版本特性为可使用楼中楼楼层、新页面
    const newVideoPageV3="body.harmony-font.header-v2.win.always-show-duration div#app.app-v1 div.video-container-v1 div.left-container div.left-container-under-player div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title span.nav-title-text" //新版视频页版本三特征 //版本特性为不可使用楼中楼楼层、新页面
    const workshopLive2dPage="div.live2d div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix" //创意工坊live2d页面特征
    const workshopIllustPage="div.illust div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix" //创意工坊插画页面特征
    const userSpacePage="div.s-space div div#page-dynamic.wrapper.clearfix div.col-1 div.bili-dyn-list div.bili-dyn-list__items" //用户个人空间页面特征
    const albumDynamicDetailedPage="div#app div.content div.card div.bili-dyn-item .bili-album" //含图片动态详细页面特征
    const textDynamicDetailedPage="div#app div.content div.card div.bili-dyn-item" //纯文字动态详细页面特征

    //旧版视频页总楼层数
    const oldVPReplyCounts1=".comment-m .common .b-head:not(.e)"
    const oldVPReplyCounts2=".comment-m .common .b-head.e"
    //新版视频页版本一总楼层数,VP=VideoPage
    const newVPReplyV1Counts1="div#comment.comment-m-v1 div.comment div.bb-comment div.comment-header.clearfix div.tabs-order ul.clearfix:not(.e)"
    const newVPReplyV1Counts2="div#comment.comment-m-v1 div.comment div.bb-comment div.comment-header.clearfix div.tabs-order ul.clearfix.e"
    //新版视频页版本二总楼层数
    const newVPReplyV2Counts1="div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title:not(.e)"
    const newVPReplyV2Counts2="div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title.e"
    //新版视频页版本三总楼层数
    const newVPReplyV3Counts1="div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title:not(.e)"
    const newVPReplyV3Counts2="div#comment.comment-m-v1 div.comment div.bili-comment.browser-pc div.reply-header div.reply-navigation ul.nav-bar li.nav-title.e"
    //创意工坊live2d页面总楼层数,WLP=workshopLive2dPage
    const WLPReplyCounts1="div.live2d div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix:not(.e)"
    const WLPReplyCounts2="div.live2d div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix.e"
    //创意工坊插画页面总楼层数,WIP=workshopIllustPage
    const WIPReplyCounts1="div.illust div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix:not(.e)"
    const WIPReplyCounts2="div.illust div.container div.left div.comment-area div.bb-comment div.comment-header div.tabs-order ul.clearfix.e"
    //用户个人空间页面总楼层数,USP=userSpacePage
    const USPReplyCounts1="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix div.tabs-order:not(.e)"
    const USPReplyCounts2="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix div.tabs-order.e"
    //含图片动态详细页面总楼层数,ADDP=albumDynamicDetailedPage
    const ADDPReplyCounts1="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix:not(.e)"
    const ADDPReplyCounts2="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix.e"
    //纯文字动态详细页面总楼层数,TDDP=textDynamicDetailedPage
    const TDDPReplyCounts1="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix:not(.e)"
    const TDDPReplyCounts2="div.dynamic-card-comment div.bb-comment div.comment-header.clearfix.e"

    var oldVPObserverOpening=false //旧版视频页观察器是否打开
    var newVPObserverOpening=false //新版视频页观察器是否打开
    var WLPObserverOpening=false //创意工坊live2d页面观察器是否打开
    var WIPObserverOpening=false //创意工坊插画页面观察器是否打开
    var USPObserverOpening=false //用户个人空间页面观察器是否打开
    var ADDPObserverOpening=false //含图片动态详细页面观察器是否打开
    var TDDPObserverOpening=false //纯文字动态详细页面观察器是否打开

    function createXhr(url){
        let xhr=new XMLHttpRequest()
        xhr.open("get",url)
        xhr.responseType="json"
        xhr.withCredentials=true
        return xhr
    }

    setInterval(() => {
        var whichPage="-1" //0=旧版视频页,1=新版视频页V1,2=新版视频页V2,3=新版视频页V3,4=创意工坊live2d页面,5=创意工坊插画页面,6=用户个人空间,7=含图片动态详细页面,8=纯文字动态详细页面
        if (document.querySelector(oldVideoPage)){
            whichPage="0"
        }
        if (document.querySelector(newVideoPageV1)){
            whichPage="1"
        }
        if (document.querySelector(newVideoPageV2)){
            whichPage="2"
        }
        if (document.querySelector(newVideoPageV3)){
            whichPage="3"
        }
        if (document.querySelector(workshopLive2dPage)){
            whichPage="4"
        }
        if (document.querySelector(workshopIllustPage)){
            whichPage="5"
        }
        if (document.querySelector(userSpacePage)){
            whichPage="6"
        }
        if (document.querySelector(albumDynamicDetailedPage)){
            whichPage="7"
        }
        if (document.querySelector(textDynamicDetailedPage)&&document.querySelector(albumDynamicDetailedPage)==null){
            whichPage="8"
        }


        if (whichPage=="0"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的li,特殊标识,方便操作


            //===在视频页面显示总楼层数===
            if (document.querySelector(oldVPReplyCounts1)){
                let owo1=document.querySelector(oldVPReplyCounts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=1&oid=${window.aid?window.aid:window.player.getUserParams().input.aid}&mode=2`) //获取最新评论
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector(".b-head-t.results")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector(".b-head-t"))
                            let owowo1=document.createElement("span")
                            let owowo2=document.createElement("span")
                            owowo1.innerHTML=`${owowowo2}`
                            owowo2.innerHTML="楼"
                            owowo1.setAttribute("style",`margin-left:17px; margin-right:3px; font-size:80%; opacity:0.8`)
                            owowo2.setAttribute("style",`font-size:90%; opacity:0.8`)
                            owowo1.classList.add("g")
                            owo1.appendChild(owowo1)
                            owo1.appendChild(owowo2)
                        }
                    }
                }
            }
            //===end===


            //===设置 回复 按钮样式===
            if(document.querySelector(replyBtn)){
                for(let i1 of document.querySelectorAll(replyBtn)){
                    i1.setAttribute("style","height:16px !important; padding-top:2px !important; padding-bottom:2px !important")
                    i1.classList.add("b")
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`)
                    //  `//api.bilibili.com/x/v2/reply/detail?type=12&oid=1&root=${i.attributes["data-id"].value}`); //另一个api接口,可用
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style","height:16px; margin-right:14px");
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style","height:16px; margin-right:14px")
                            span.innerHTML=`#${data}`
                            i4_2_1_1.appendChild(span)
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 按热度排序 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && oldVPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(oldVPReplyCounts2)){
                        let RCChangeClass=document.querySelector(oldVPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                oldVPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="1"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的li,特殊标识,方便操作


            //===在视频页面显示总楼层数===
            if (document.querySelector(newVPReplyV1Counts1)){
                let owo1=document.querySelector(newVPReplyV1Counts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=1&oid=${window.aid?window.aid:window.player.getUserParams().input.aid}&mode=2`) //获取最新评论
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .default-sort:not(owo)")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .total-reply:not(owo)"))
                            let owowo1=document.createElement("li")
                            let owowo2=document.createElement("li")
                            owowo1.innerHTML="楼层"
                            owowo2.innerHTML=`${owowowo2}`
                            owowo2.setAttribute("style",`height:${style2.height}; margin-right:${style2.marginRight}; line-height:${style2.lineHeight}; font-size:${style2.fontSize}; color:${style2.color}`)
                            owowo1.classList.add("default-sort") //为设置网站自带css
                            owowo2.classList.add("default-sort") //设置成这个class是因为设置成其他的都会出问题,并非为了设置网站自带css
                            owowo1.classList.add("owo")
                            owowo2.classList.add("owo")
                            owowo2.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[2]) //向列表中指定位置插入一个项目
                            owo1.insertBefore(owowo2,owo1.childNodes[3])
                            document.querySelector("li.total-reply:not(.owo)").setAttribute("style","margin-right:20px")
                        }
                    }
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                let spanHeight=window.getComputedStyle(document.querySelector("div.con div.info span.like span")).lineHeight //在没有文本的时候height会为0,所以用line-height
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`)
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style",`height:${spanHeight}; margin-right:16px;`);
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                let FIFSpanHeight=window.getComputedStyle(document.querySelector("div.reply-box div.reply-item.reply-wrap div.info span.like span")).lineHeight
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style",`height:${FIFSpanHeight}; margin-right:16px;`)
                            span.innerHTML=`#${data}`
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 最热 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && newVPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(newVPReplyV1Counts2)){
                        let RCChangeClass=document.querySelector(newVPReplyV1Counts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                newVPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="2"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1="div.reply-list div.reply-item:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2="div.reply-list div.reply-item.c"
            let separateReply3="div.reply-list div.reply-item"
            let floorInFloor1="div.sub-reply-container div.sub-reply-list div.sub-reply-item" //楼中楼
            let floorInFloor2="div.sub-reply-container div.sub-reply-list div.sub-reply-item:not(.d)"
            let replyOperation="div.reply-operation-warp div.reply-operation ul.operation-list:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的span,特殊标识,方便操作


            //===在视频页面显示总楼层数===
            if (document.querySelector(newVPReplyV2Counts1)){
                let owo1=document.querySelector(newVPReplyV2Counts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=1&oid=${window.aid?window.aid:window.player.getUserParams().input.aid}&mode=2`) //获取最新评论
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.nav-title-text:not(owo)")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.total-reply:not(owo)"))
                            let owowo1=document.createElement("span")
                            let owowo2=document.createElement("span")
                            owowo1.innerHTML="楼层"
                            owowo2.innerHTML=`${owowowo2}`
                            owowo1.setAttribute("style",`height:${style1.height}; margin-left:${style1.marginLeft}; margin-right:${style1.marginRight}; line-height:${style1.lineHeight}; font-family:${style1.fontFamily}; font-size:100%; font-weight:${style1.fontWeight}; color:${style1.color}`)
                            owowo2.setAttribute("style",`height:${style2.height}; margin-left:${style2.marginLeft}; margin-right:${style2.marginRight}; line-height:${style2.lineHeight}; font-family:${style2.fontFamily}; font-size:${style2.fontSize}; font-weight:${style2.fontWeight}; color:${style2.color}`)
                            owowo1.classList.add("owo")
                            owowo2.classList.add("owo")
                            owowo2.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[2]) //向列表中指定位置插入一个项目
                            owo1.insertBefore(owowo2,owo1.childNodes[3])
                            document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.total-reply:not(.owo)").setAttribute("style","margin-right:22px")
                        }
                    }
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

//                 //显示 显示楼中楼 按钮,以及对应功能
//                 for (let i2 of document.querySelectorAll(separateReply1)){
//                     if (i2.querySelector(replyOperation)){
//                         let i2_1=i2.querySelector(replyOperation)

//                         let li=document.createElement("li")
//                         li.setAttribute("class","operation-option")

//                         let span=document.createElement("span")
//                         span.setAttribute("class","option-title")

//                         li.addEventListener("click",(()=>{ //点击事件
//                             i2.classList.add("c")
//                         }))

//                         span.innerHTML="楼中楼楼层"

//                         li.appendChild(span)
//                         i2_1.appendChild(li)
//                         i2_1.classList.add("b")
//                     }
//                 }

                //显示楼层
                let spanHeight=window.getComputedStyle(document.querySelector("div.sub-reply-info span.sub-reply-like span")).lineHeight //在没有文本的时候height会为0,所以用line-height
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".reply-info")

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.querySelector(".root-reply-avatar").attributes["data-root-reply-id"].value}`)
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style",`height:${spanHeight};margin-right:18px`);
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[4]) //加在div info里的第四位
                    }
                }
            }
            //===end===


//             //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
//             if (document.querySelector(floorInFloor1)){
//                 let FIFSpanHeight=window.getComputedStyle(document.querySelector("div.sub-reply-list div.sub-reply-item div.sub-reply-info span.sub-reply-like")).lineHeight
//                 for (let i4 of document.querySelectorAll(separateReply2)){
//                     let i4_2=i4.querySelectorAll(floorInFloor2)

//                     for (let i4_2_1 of i4_2){
//                         let i4_2_1_1=i4_2_1.querySelector(".sub-reply-info")
//                         i4_2_1.classList.add("d")

//                         let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.querySelector(".sub-reply-avatar").attributes["data-root-reply-id"].value}`)
//                         xhr.send()

//                         xhr.onload=()=>{
//                             let data=xhr.response.data.floor
//                             let span=document.createElement("span")
//                             span.setAttribute("style",`height:${FIFSpanHeight};margin-right:14px`)
//                             span.innerHTML=`#${data}`
//                             i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[4])
//                         }
//                     }
//                 }
//             }
//             //===end===


            //===侦测 最热 div,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector("div.reply-navigation ul.nav-bar li.nav-sort") && newVPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector("div.reply-navigation ul.nav-bar li.nav-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(newVPReplyV2Counts2)){
                        let RCChangeClass=document.querySelector(newVPReplyV2Counts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                newVPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





            if (whichPage=="3"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1="div.reply-list div.reply-item:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2="div.reply-list div.reply-item.c"
            let separateReply3="div.reply-list div.reply-item"
            let floorInFloor1="div.reply-warp div.reply-list div.reply-item div.content-warp div.sub-reply-list div.sub-reply-item" //楼中楼
            let floorInFloor2="div.reply-warp div.reply-list div.reply-item div.content-warp div.sub-reply-list div.sub-reply-item:not(.d)"
            let replyOperation="div.reply-operation-warp div.reply-operation ul.operation-list:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的span,特殊标识,方便操作


            //===在视频页面显示总楼层数===
            if (document.querySelector(newVPReplyV3Counts1)){
                let owo1=document.querySelector(newVPReplyV3Counts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=1&oid=${window.aid?window.aid:window.player.getUserParams().input.aid}&mode=2`) //获取最新评论
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.nav-title-text:not(owo)")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.total-reply:not(owo)"))
                            let owowo1=document.createElement("span")
                            let owowo2=document.createElement("span")
                            owowo1.innerHTML="楼层"
                            owowo2.innerHTML=`${owowowo2}`
                            owowo1.setAttribute("style",`height:${style1.height}; margin-left:${style1.marginLeft}; margin-right:${style1.marginRight}; line-height:${style1.lineHeight}; font-family:${style1.fontFamily}; font-size:100%; font-weight:${style1.fontWeight}; color:${style1.color}`)
                            owowo2.setAttribute("style",`height:${style2.height}; margin-left:${style2.marginLeft}; margin-right:${style2.marginRight}; line-height:${style2.lineHeight}; font-family:${style2.fontFamily}; font-size:${style2.fontSize}; font-weight:${style2.fontWeight}; color:${style2.color}`)
                            owowo1.classList.add("owo")
                            owowo2.classList.add("owo")
                            owowo2.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[2]) //向列表中指定位置插入一个项目
                            owo1.insertBefore(owowo2,owo1.childNodes[3])
                            document.querySelector("div.reply-navigation ul.nav-bar li.nav-title.e span.total-reply:not(.owo)").setAttribute("style","margin-right:22px")
                        }
                    }
                }
            }
            //===end===


            //===显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply3)) {

                //显示楼层
                let spanHeight=window.getComputedStyle(document.querySelector("div.content-warp div.root-reply div.reply-info span.reply-like")).lineHeight //在没有文本的时候height会为0,所以用line-height
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".reply-info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.querySelector(".root-reply-avatar").attributes["data-root-reply-id"].value}`)
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style",`height:${spanHeight}; margin-right:22px`);
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[4]) //加在div info里的第四位
                    }
                }
            }
            //===end===


            //===侦测 最热 div,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector("div.reply-navigation ul.nav-bar li.nav-sort") && newVPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector("div.reply-navigation ul.nav-bar li.nav-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(newVPReplyV3Counts2)){
                        let RCChangeClass=document.querySelector(newVPReplyV3Counts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                newVPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="4"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的li,特殊标识,方便操作


            //===在页面显示总楼层数===
            if (document.querySelector(WLPReplyCounts1)){
                let owo1=document.querySelector(WLPReplyCounts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=42&oid=${window.location.pathname.split("/")[2]}&mode=2`) //获取最新评论 //获取url的文件名,以/为界分割,用最后一个,即oid
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .default-sort:not(owo)")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .total-reply:not(owo)"))
                            let owowo1=document.createElement("li")
                            let owowo2=document.createElement("li")
                            owowo1.innerHTML="楼层"
                            owowo2.innerHTML=`${owowowo2}`
                            owowo2.setAttribute("style",`height:${style2.height}; margin-right:${style2.marginRight}; line-height:${style2.lineHeight}; font-size:${style2.fontSize}; color:${style2.color}`)
                            owowo1.classList.add("default-sort") //为设置网站自带css
                            owowo2.classList.add("default-sort") //设置成这个class是因为设置成其他的都会出问题,并非为了设置网站自带css
                            owowo1.classList.add("owo")
                            owowo2.classList.add("owo")
                            owowo2.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[2]) //向列表中指定位置插入一个项目
                            owo1.insertBefore(owowo2,owo1.childNodes[3])
                            document.querySelector("li.total-reply:not(.owo)").setAttribute("style","margin-right:20px")
                        }
                    }
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                let spanHeight=window.getComputedStyle(document.querySelector("div.con div.info span.like span")).lineHeight //在没有文本的时候height会为0,所以用line-height
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`);
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style",`height:${spanHeight}; margin-right:14px`);
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                let FIFSpanHeight=window.getComputedStyle(document.querySelector("div.reply-box div.reply-item.reply-wrap div.info span.like span")).lineHeight
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style",`height:${FIFSpanHeight};margin-right:14px`)
                            span.innerHTML=`#${data}`
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 最热 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && WLPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(WLPReplyCounts2)){
                        let RCChangeClass=document.querySelector(WLPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                WLPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="5"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表视频总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的li,特殊标识,方便操作


            //===在页面显示总楼层数===
            if (document.querySelector(WIPReplyCounts1)){
                let owo1=document.querySelector(WIPReplyCounts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=42&oid=${window.location.pathname.split("/")[2]}&mode=2`) //获取最新评论 //获取url的文件名,以/为界分割,用最后一个,即oid
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}`
                        }
                        else{
                            let style1=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .default-sort:not(owo)")) //读取最终样式,包括内联样式、嵌入样式和外部样式
                            let style2=window.getComputedStyle(document.querySelector(".tabs-order .clearfix .total-reply:not(owo)"))
                            let owowo1=document.createElement("li")
                            let owowo2=document.createElement("li")
                            owowo1.innerHTML="楼层"
                            owowo2.innerHTML=`${owowowo2}`
                            owowo2.setAttribute("style",`height:${style2.height}; margin-right:${style2.marginRight}; line-height:${style2.lineHeight}; font-size:${style2.fontSize}; color:${style2.color}`)
                            owowo1.classList.add("default-sort") //为设置网站自带css
                            owowo2.classList.add("default-sort") //设置成这个class是因为设置成其他的都会出问题,并非为了设置网站自带css
                            owowo1.classList.add("owo")
                            owowo2.classList.add("owo")
                            owowo2.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[2]) //向列表中指定位置插入一个项目
                            owo1.insertBefore(owowo2,owo1.childNodes[3])
                            document.querySelector("li.total-reply:not(.owo)").setAttribute("style","margin-right:20px")
                        }
                    }
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                let spanHeight=window.getComputedStyle(document.querySelector("div.con div.info span.like span")).lineHeight //在没有文本的时候height会为0,所以用line-height
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`);
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style",`height:${spanHeight}; margin-right:14px`);
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                let FIFSpanHeight=window.getComputedStyle(document.querySelector("div.reply-box div.reply-item.reply-wrap div.info span.like span")).lineHeight
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style",`height:${FIFSpanHeight};margin-right:14px`)
                            span.innerHTML=`#${data}`
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 最热 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && WIPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(WIPReplyCounts2)){
                        let RCChangeClass=document.querySelector(WIPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                WIPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="6"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表动态总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表{████},特殊标识,方便操作


            //===在动态页面显示总楼层数===
//             if (document.querySelector(USPReplyCounts1)){
//                 let owo1=document.querySelector(USPReplyCounts1)
//                 owo1.classList.add("e")

//                 let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
//                 owo1.classList.remove("f")

//                 let xhr1=new XMLHttpRequest() //获取最新评论
//                 xhr1.open("get",`//api.bilibili.com/x/v2/reply/main?type=1&oid=${window.aid}&mode=2`)
//                 xhr1.responseType="json"
//                 xhr1.withCredentials=true
//                 xhr1.send()

//                 xhr1.onload=()=>{
//                     let owowowo1=xhr1.response.data.replies[0].rpid

//                     let xhr2=new XMLHttpRequest() //获取最新评论的楼层
//                     xhr2.open("get",`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo1}`)
//                     xhr2.responseType="json"
//                     xhr2.withCredentials=true
//                     xhr2.send()

//                     xhr2.onload=()=>{
//                         let owowowo2=xhr2.response.data.floor
//                         if (contains==true){ //如果总楼层数已显示,则改为替换数字,否则创建新的
//                             let owowo1change=owo1.querySelector(".g")
//                             owowo1change.innerHTML=`${owowowo2}`
//                         }
//                         else{
//                             let owowo1=document.createElement("span")
//                             let owowo2=document.createElement("span")
//                             owowo1.innerHTML=`${owowowo2}`
//                             owowo2.innerHTML="楼"
//                             owowo1.setAttribute("style","margin-left:17px; margin-right:3px; font-size:80%; color:#a1a1a1")
//                             owowo2.setAttribute("style","font-size:90%; color:#a1a1a1")
//                             owowo1.classList.add("g")
//                             owo1.appendChild(owowo1)
//                             owo1.appendChild(owowo2)
//                         }
//                     }
//                 }
//             }
            //===end===


            //===设置 回复 按钮样式===
            if(document.querySelector(replyBtn)){
                for(let i1 of document.querySelectorAll(replyBtn)){
                    i1.setAttribute("style","height:16px !important; padding-top:2px !important; padding-bottom:2px !important")
                    i1.classList.add("b")
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`);
                    //xhr.open("get", `//api.bilibili.com/x/v2/reply/detail?type=12&oid=1&root=${i.attributes["data-id"].value}`); //另一个api接口,可用
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style","height:16px; margin-right:14px");
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style","height:16px; margin-right:14px")
                            span.innerHTML=`#${data}`
                            i4_2_1_1.appendChild(span)
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 按热度排序 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && USPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(USPReplyCounts2)){
                        let RCChangeClass=document.querySelector(USPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                USPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="7"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表动态总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的span,特殊标识,方便操作


            //===在动态页面显示总楼层数===
            if (document.querySelector(ADDPReplyCounts1)){
                let owo1=document.querySelector(ADDPReplyCounts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?dynamic_id=${window.location.href.split("/")[3]}`) //获取动态oid
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.card.desc.rid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/main?type=11&oid=${owowowo1}&mode=2`) //获取最新评论
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.replies[0].rpid

                        let xhr3=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${owowowo2}`) //获取最新评论的楼层
                        xhr3.send()

                        xhr3.onload=()=>{
                            let owowowo3=xhr3.response.data.floor
                            if (contains==true){ //如果总楼层数已显示,则更新,否则创建新的
                                let owowo1change=owo1.querySelector(".g")
                                owowo1change.innerHTML=`${owowowo3}楼`
                            }
                            else{
                                let owowo1=document.createElement("span")
                                owowo1.innerHTML=`${owowowo3}楼`
                                owowo1.setAttribute("style","margin:0 !important; line-height:normal; font-size:14px; font-weight:700; padding-top:8px; padding-bottom:8px; float:right; opacity:0.7;")
                                owowo1.classList.add("g")
                                owo1.insertBefore(owowo1,owo1.childNodes[1])
                            }
                        }
                    }
                }
            }
            //===end===


            //===设置 回复 按钮样式===
            if(document.querySelector(replyBtn)){
                for(let i1 of document.querySelectorAll(replyBtn)){
                    i1.setAttribute("style","height:16px !important; padding-top:2px !importan; adding-bottom:2px !important")
                    i1.classList.add("b")
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i3.attributes["data-id"].value}`);
                    //xhr.open("get", `//api.bilibili.com/x/v2/reply/detail?type=12&oid=1&root=${i.attributes["data-id"].value}`); //另一个api接口,可用
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style","height:16px; margin-right:14px");
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=12&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style","height:16px;margin-right:14px")
                            span.innerHTML=`#${data}`
                            i4_2_1_1.appendChild(span)
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 按热度排序 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && ADDPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(ADDPReplyCounts2)){
                        let RCChangeClass=document.querySelector(ADDPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                ADDPObserverOpening=true
            }
            //===end===
        }





//#

//=

//#

//=

//#





        if (whichPage=="8"){
            let replyBtn=".reply.btn-hover:not(.b)" //排除已被 b class包含的元素
            let separateReply1=".list-item.reply-wrap:not(.a)" //寻找相应属性的div 有独立楼层非楼中楼的回复
            let separateReply2=".list-item.reply-wrap.c"
            let floorInFloor1=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap" //楼中楼
            let floorInFloor2=".list-item.reply-wrap.c .con .reply-box .reply-item.reply-wrap:not(.d)"
            let replyOperation=".operation.more-operation .opera-list ul:not(.b)" //评论旁边的三个点


            //e代表动态总楼层数已准备完成
            //f代表出现切换 按xx排序 的操作,但还没刷新楼层数
            //g代表总楼层数的span,特殊标识,方便操作


            //===在动态页面显示总楼层数===
            if (document.querySelector(TDDPReplyCounts1)){
                let owo1=document.querySelector(TDDPReplyCounts1)
                owo1.classList.add("e")

                let contains=owo1.classList.contains("f") //返回布尔值,判断指定的类名是否存在
                owo1.classList.remove("f")

                let xhr1=createXhr(`//api.bilibili.com/x/v2/reply/main?type=17&oid=${window.location.href.split("/")[3]}&mode=2`) //获取最新评论
                xhr1.send()

                xhr1.onload=()=>{
                    let owowowo1=xhr1.response.data.replies[0].rpid

                    let xhr2=createXhr(`//api.bilibili.com/x/v2/reply/info?type=17&oid=1&rpid=${owowowo1}`) //获取最新评论的楼层
                    xhr2.send()

                    xhr2.onload=()=>{
                        let owowowo2=xhr2.response.data.floor
                        if (contains==true){ //如果总楼层数已显示,则更新,否则创建新的
                            let owowo1change=owo1.querySelector(".g")
                            owowo1change.innerHTML=`${owowowo2}楼`
                        }
                        else{
                            let owowo1=document.createElement("span")
                            owowo1.innerHTML=`${owowowo2}楼`
                            owowo1.setAttribute("style","margin:0 !important; line-height:normal; font-size:14px; font-weight:700; padding-top:8px; padding-bottom:8px; float:right; opacity:0.7;")
                            owowo1.classList.add("g")
                            owo1.insertBefore(owowo1,owo1.childNodes[1])
                        }
                    }
                }
            }
            //===end===


            //===设置 回复 按钮样式===
            if(document.querySelector(replyBtn)){
                for(let i1 of document.querySelectorAll(replyBtn)){
                    i1.setAttribute("style","height:16px !important; padding-top:2px !importan; adding-bottom:2px !important")
                    i1.classList.add("b")
                }
            }
            //===end===


            //===显示 显示楼中楼 按钮 && 显示独立非楼中楼评论楼层===
            if (document.querySelector(separateReply1)) {

                //显示 显示楼中楼 按钮,以及对应功能
                for (let i2 of document.querySelectorAll(separateReply1)){
                    if (i2.querySelector(replyOperation)){
                        let i2_1=i2.querySelector(replyOperation)

                        let li=document.createElement("li");
                        li.setAttribute("class","fif") //fif=floor-in-floor

                        li.addEventListener("click",(()=>{ //点击事件
                            i2.classList.add("c")
                        }))

                        li.innerHTML="楼中楼楼层"

                        i2_1.appendChild(li)
                        i2_1.classList.add("b")
                    }
                }

                //显示楼层
                for (let i3 of document.querySelectorAll(separateReply1)) {
                    i3.classList.add("a");
                    let qwq = i3.querySelector(".info");

                    let xhr = createXhr(`//api.bilibili.com/x/v2/reply/info?type=17&oid=1&rpid=${i3.attributes["data-id"].value}`);
                    xhr.send();

                    xhr.onload = () => {
                        let data = xhr.response.data.floor
                        let qwqwq = document.createElement("span");
                        qwqwq.setAttribute("style","height:16px; margin-right:14px");
                        qwqwq.innerHTML = `#${data}`;
                        qwq.insertBefore(qwqwq,qwq.childNodes[3]) //加在div info里的第三位
                    }
                }
            }
            //===end===


            //===赋予 楼中楼楼层 按钮功能,即显示楼中楼楼层===
            if (document.querySelector(floorInFloor1)){
                for (let i4 of document.querySelectorAll(separateReply2)){
                    let i4_2=i4.querySelectorAll(floorInFloor2)

                    for (let i4_2_1 of i4_2){
                        let i4_2_1_1=i4_2_1.querySelector(".info")
                        i4_2_1.classList.add("d")

                        let xhr=createXhr(`//api.bilibili.com/x/v2/reply/info?type=17&oid=1&rpid=${i4_2_1.attributes["data-id"].value}`)
                        xhr.send()

                        xhr.onload=()=>{
                            let data=xhr.response.data.floor
                            let span=document.createElement("span")
                            span.setAttribute("style","height:16px;margin-right:14px")
                            span.innerHTML=`#${data}`
                            i4_2_1_1.appendChild(span)
                            i4_2_1_1.insertBefore(span,i4_2_1_1.childNodes[3])
                        }
                    }
                }
            }
            //===end===


            //===侦测 按热度排序 li,出现变动就改变replyCounts的class,做到和评论总数同步的刷新===
            if (document.querySelector(".tabs-order .clearfix .hot-sort") && TDDPObserverOpening==false){ //observer仅需开启一次,过多的开启会拖累性能,脚本的每次循环不会重置observer
                let observerTarget=document.querySelector(".tabs-order .clearfix .hot-sort")
                let observerConfig={attributes: true,childList: true,subtree: true,classList:true}
                let observerCallback=()=>{
                    if (document.querySelector(TDDPReplyCounts2)){
                        let RCChangeClass=document.querySelector(TDDPReplyCounts2) //RCChangeClass=replyCountsChangeClass
                        RCChangeClass.classList.remove("e")
                        RCChangeClass.classList.add("f")
                    }
                }
                let observer=new MutationObserver(observerCallback) //创建一个观察器并传入回调参数
                observer.observe(observerTarget,observerConfig) //以这两个配置开始观察
                TDDPObserverOpening=true
            }
            //===end===
        }


    }, 1000);
})();