您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
as title
// ==UserScript== // @name bangumi免登录(不可用)黑名单 // @namespace bangumiBlacklistWithoutLogin // @version 1.4 // @description as title // @author sai // @match https://bgm.tv/* // @match https://bangumi.tv/* // @match https://chii.in/* // @license MIT // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (function() { 'use strict'; const URL = window.location.href; const isTopic = /topic/.test(URL); const isGroup = /group/.test(URL); const isSubject = /subject/.test(URL); const blacklist = GM_getValue("blacklist") === undefined ? [] : GM_getValue("blacklist").split(","); function hiddenObj(obj){ let nodes = document.querySelectorAll(obj); if(nodes.length == 0 || blacklist.length == 0) return; nodes.forEach(i => { if(blacklist.indexOf(i.dataset.itemUser) > -1){ i.hidden = true; console.log(i.dataset.itemUser); } }); } function applyBlock(){ hiddenObj(".row_reply"); hiddenObj(".sub_reply_bg"); hiddenObj(".postTopic"); } function addNode(nodeName,textContent,attr){ let node = document.createElement(nodeName); if(textContent.length > 0) node.append(document.createTextNode(textContent)); if(attr.length > 0){ for(let i = 0;i < attr.length;i += 2){ node.setAttribute(attr[i],attr[i + 1]); } } return node; } function addBtn(){ let moreAction = document.querySelectorAll(".post_actions.re_info > .action.dropdown:last-of-type > ul"); if(moreAction.length == 0){ document.querySelectorAll(".post_actions.re_info").forEach(actions => { let action = addNode("div","",["class","action dropdown"]); let ul = addNode("ul","",[]); let a = addNode("a","",["class","icon","href","javascript:void(0);"]); let span = addNode("span","...",["class","ico ico_more"]); a.append(span); action.append(a); action.append(ul); actions.append(action); }) moreAction = document.querySelectorAll(".post_actions.re_info > .action.dropdown:last-of-type > ul"); } moreAction.forEach(ma => { let li = addNode("li","",[]); li.appendChild(addNode("a","屏蔽",["href","javascript:void(0);"])); li.appendChild(addNode("a","屏蔽数据",["href","javascript:void(0);"])); ma.appendChild(li); }) document.addEventListener("click", event => { if(event.target.text === "屏蔽"){ blacklist.push(event.target.closest(".post_actions.re_info").parentElement.dataset.itemUser); GM_setValue("blacklist", blacklist.toString()); applyBlock(); } if(event.target.text === "屏蔽数据"){ } }) } if(isTopic){ applyBlock(); addBtn(); }else if(isGroup || isSubject){ hiddenObj(".topic_list > tbody > tr"); } })();