// ==UserScript== // @name 本地黑名单-新浪微博 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 我的地盘,我做主! // @author lavaf // @match https://weibo.com/ // @match https://weibo.com/* // @match https://s.weibo.com/weibo?q=* // @grant none // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; ////www.zhihu.com/people/ let blackList=['1095240537','1739623952','2422966453','5872687669','6071579739','2832328014','1246989224']; setInterval(function () { //console.log('start') let nameList=$("div.WB_feed_type"); nameList.each(function (i,e) { if ($(e).attr('data-lavaf') !== '1') { let fb = $(e).find("a.W_fb"); if (fb.length == 0) { console.log(e); return; } let id = fb.attr("usercard"); for (const blackListKey in blackList) { if (blackList.hasOwnProperty(blackListKey)) { //console.log(id); let index=id.indexOf("&"); let s = id.substring(3,index); //console.log("s:"+s+" "+id); if (blackList[blackListKey] === s) { $(e).text(id+" 此用户已经被屏蔽") $(e).attr('data-lavaf','1'); break; } } } } }); let List=$("div.list_li"); List.each(function (i,e) { if ($(e).attr('data-lavaf') !== '1') { let id = $(e).find('div.WB_text').children("a").attr("usercard") for (const blackListKey in blackList) { if (blackList.hasOwnProperty(blackListKey)) { //console.log(id); if ("id="+blackList[blackListKey] === id) { $(e).text(id+" 此用户已经被屏蔽") $(e).attr('data-lavaf','1'); } } } } }); let List1=$("div.card-wrap[action-type='feed_list_item']"); List1.each(function (i,e) { if ($(e).attr('data-lavaf') !== '1') { let fb = $(e).find("a.name"); if (fb.length == 0) { console.log(e); return; } let id = fb.attr("href"); for (const blackListKey in blackList) { if (blackList.hasOwnProperty(blackListKey)) { //console.log(id); //console.log("s:"+s+" "+id); if (id.indexOf("//weibo.com/"+blackList[blackListKey]+"?") === 0) { $(e).text(id+" 此用户已经被屏蔽") $(e).attr('data-lavaf','1'); break; } } } } }); },500) })();