本文学习自:https://www.cnblogs.com/sunshine-wy/p/11133987.html
1.新建manifest.json文件,写入如下内容:
{
"manifest_version": 2,
"name" : "闪存过滤器",
"description" : "不喜欢的人过滤掉就好啦~~",
"version": "1.0.0.0",
"content_scripts" :[
{
"matches" : ["*://ing.cnblogs.com/*"],
"js" : ["jquery-3.3.1.min.js","main.js"]
}
]
}
//main.js
var Home = function () {
var _this = this;
this.Init = function () {
console.log("插件启动成功!");
//加载页面时清除一次
_this.ChearUsers();
//此后每两秒定时清除一次
setInterval(_this.ChearUsers, 2000);
}
this.ChearUsers = function () {
var filterNames = new Array("测试1", "测试2");
$(".entry_a,.entry_b").each(function (i, e) {
var currDomInfo = $(e).find(".ing-author").attr("title");
$.each(filterNames, function (ii, ee) {
if (ee.length > 0)//空字符串不做处理
{
if (currDomInfo.indexOf(ee) > -1) {
$(e).remove();
console.log("已清除用户=>" + ee);
}
}
});
});
}
}
var home = new Home();
home.Init();
原文地址:https://www.cnblogs.com/smart-girl/p/11134592.html
时间: 2024-10-31 08:09:13