您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
查成分!
当前为
// ==UserScript== // @name B站共同关注查询 // @namespace https://github.com/XiaoMiku01 // @version 0.1 // @description 查成分! // @author 晓轩 // @match https://*.bilibili.com/* // @icon https://www.google.com/s2/favicons?domain=bilibili.com // @grant none // ==/UserScript== (function () { async function readJSON(uid) { return new Promise((resolve, reject) => { fetch('https://api.bilibili.com/x/relation/same/followings?vmid=' + uid, { credentials: 'include' }).then(function (data) { resolve(data.json()) }) }) } var handler = function () { setTimeout(async function addP() { let a = document.getElementsByClassName("user-card")[0].getElementsByClassName("info"); let p = document.createElement("p"); let uid = a[0].getElementsByClassName("user")[0].getElementsByClassName("name")[0].getAttribute("href").split("/").slice(-1); let names = '共同关注:</br>'; try { let data = await readJSON(uid); for (let i of data.data.list) { names += i.uname + '</br>' } } catch (error) { names = "关注列表未开放"; } p.innerHTML = names; a[0].appendChild(p); }, 1000); } var myVar = setInterval(function () { myTimer() }, 1000); function myTimer() { if (document.getElementsByClassName("user-face").length < 2) { console.log("没有评论"); } else { for (let i of document.querySelectorAll('.user-face, .reply-face')) { i.removeEventListener("mouseenter", handler) i.addEventListener("mouseenter", handler) } } } })();