// ==UserScript== // @name bilibili - 查看历史评论 // @description 文明交流,人人有责。必须正当对待别人公开发表的言论。 // @version 1.0.0 // @author 会飞的蛋蛋面 // @license All Rights Reserved - 未经授权禁止使用、复制、修改或分发 // @match https://www.bilibili.com/video/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // @connect api.aicu.cc // @run-at document-idle // @namespace https://greasyfork.org/users/751952 // @downloadURL none // ==/UserScript== (() => { // 防止滥用 'use strict';const a0a='history-reply-panel',a0b=new Map();GM_addStyle('\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20{\x20position:\x20absolute;\x20width:\x20360px;\x20max-height:\x2070vh;\x20overflow:\x20auto;\x20background:\x20#fff;\x20color:\x20#333;\x20border:\x201px\x20solid\x20#ddd;\x20border-radius:\x208px;\x20box-shadow:\x200\x206px\x2024px\x20rgba(0,0,0,.18);\x20z-index:\x2099999;\x20padding:\x2012px;\x20display:\x20none;\x20font-family:\x20inherit;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20body.dark\x20#'+a0a+'\x20{\x20background:\x20#1f1f1f;\x20color:\x20#e9eaec;\x20border-color:\x20#333;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.header\x20{\x20display:\x20flex;\x20justify-content:\x20space-between;\x20align-items:\x20center;\x20font-weight:\x20700;\x20margin-bottom:\x208px;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.close\x20{\x20padding:\x204px\x208px;\x20border:\x200;\x20background:\x20#bbb;\x20color:\x20#fff;\x20border-radius:\x204px;\x20cursor:\x20pointer;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20body.dark\x20#'+a0a+'\x20.close\x20{\x20background:\x20#444;\x20color:\x20#e9eaec;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.item\x20{\x20margin-bottom:\x208px;\x20padding-bottom:\x208px;\x20border-bottom:\x201px\x20solid\x20#f2f2f2;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20body.dark\x20#'+a0a+'\x20.item\x20{\x20border-color:\x20#2c2c2c;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.meta\x20{\x20font-size:\x2012px;\x20color:\x20#666;\x20margin-bottom:\x204px;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.meta\x20a\x20{\x20color:\x20#00a1d6;\x20text-decoration:\x20none;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20body.dark\x20#'+a0a+'\x20.meta\x20{\x20color:\x20#9ca3af;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.text\x20{\x20font-size:\x2014px;\x20white-space:\x20pre-wrap;\x20word-break:\x20break-all;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20#'+a0a+'\x20.count\x20{\x20font-size:\x2012px;\x20color:\x20#999;\x20margin-bottom:\x208px;\x20}\x0a\x20\x20\x20\x20'),a0c();async function a0c(){await a0d(),a0f();}async function a0d(){const a=await a0e(document,'bili-comments'),b=await a0e(a['shadowRoot'],'bili-comment-thread-renderer'),c=await a0e(b['shadowRoot'],'bili-comment-renderer');await a0e(c['shadowRoot'],'#body');}function a0e(a,b){return new Promise(c=>{const d=()=>{const e=a['querySelector'](b);e?c(e):setTimeout(d,0x1f4);};d();});}function a0f(){const a=document['querySelector']('bili-comments'),b=a['shadowRoot']['querySelectorAll']('bili-comment-thread-renderer');for(const c of b){const d=c['shadowRoot']['querySelector']('bili-comment-renderer');a0g(d);const e=c['shadowRoot']['querySelector']('bili-comment-replies-renderer'),f=e?.['shadowRoot']?.['querySelectorAll']('bili-comment-reply-renderer')||[];f['forEach'](a0g);}}function a0g(a){const b=a['shadowRoot']['querySelector']('#body'),c=a['shadowRoot']['querySelector']('bili-comment-action-buttons-renderer'),d=c['shadowRoot']['querySelector']('#reply'),e=b['querySelector']('a#user-avatar[href*=\x22space.bilibili.com\x22]'),f=e?.['href']['match'](/space\.bilibili\.com\/(\d+)/)?.[0x1],g=b['querySelector']('#user-name\x20a')?.['textContent']?.['trim']()||'UID'+f;a0h(d,f,g);}function a0h(a,b,c){const d=document['createElement']('div'),e=document['createElement']('button');e['textContent']='查看成分',e['onclick']=f=>a0i(f,b,c),d['appendChild'](e),a['after'](d);}async function a0i(a,b,c){let d=document['getElementById'](a0a);!d&&(d=document['createElement']('div'),d['id']=a0a,document['body']['appendChild'](d));const f=a['target']['getBoundingClientRect']();d['style']['left']=f['left']+window['scrollX']+'px',d['style']['top']=f['bottom']+window['scrollY']+0x5+'px',d['innerHTML']='