Bilibili 翻页评论区

恢复原来的翻页评论区,同时修复评论楼层号。

目前為 2021-06-04 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Bilibili 翻页评论区
// @namespace    MotooriKashin
// @version      0.1.9
// @description  恢复原来的翻页评论区,同时修复评论楼层号。
// @author       MotooriKashin
// @match        *://*.bilibili.com/*
// @resource     script https://cdn.jsdelivr.net/gh/MotooriKashin/Bilibili-Old@8f72bc5b796477b47119c9ffab3fdb7435b4f70a/JavaScript/comment.min.js
// @resource     style https://static.hdslb.com/phoenix/dist/css/comment.min.css
// @run-at       document-start
// @grant        GM_getResourceText
// @license      MIT License
// ==/UserScript==

(function() {
    'use strict';

    function addCss(css, id) {
        if (!css) return;
        if (!document.head) return setTimeout(() => { this.addCss(css, id) });
        let style = document.createElement("style");
        if (id) {
            if (document.querySelector("#" + id)) return;
            style.setAttribute("id", id);
        }
        style.setAttribute("type", "text/css");
        style.appendChild(document.createTextNode(css));
        if (document.head) document.head.appendChild(style);
    }
    function cover() {
        delete unsafeWindow.bbComment;
        new Function(GM_getResourceText("script"))();
        addCss(GM_getResourceText("style") + ".bb-comment .comment-header .header-page, .comment-bilibili-fold .comment-header .header-page { float: right;line-height: 36px;}");
    }
    if (unsafeWindow.bbComment) cover();
    else {
        Object.defineProperty(unsafeWindow, "bbComment", {
            set: () => { cover() },
            get: () => undefined,
            configurable: true
        })
    }
})();