十年前的时候,百度用起来还是顺手的,长期以来一直是我的浏览器首页。但是垄断了之后就任性,搜索结果里的有效信息要翻几页去找,右侧还推送些分散注意力的信息。尤其是很多毒奶信息,比如XXX结婚把妹被绿离婚出轨泡吧等等。
我一点都不关心,因此决定屏蔽掉这些毒奶。
最简单的方法是用adblock屏蔽右侧元素,规则是:
baidu.com###content_right
baidu.com##.cr-offset
但是我依然不想在网页上看到这些人的消息,所以用浏览器执行以下脚本:
var Names = new Array("范冰冰","王思聪","孙杨","李晨","迪丽热巴","宁泽涛","傅园慧","鄢军","周立波","贾乃亮","火箭少女","吴亦凡","鹿晗","关晓彤","逐梦演艺圈","科比","李易峰","杨洋");
String.prototype.myReplace = function(f,e) {
var reg=new RegExp(f,"g");
return this.replace(reg,e);
};
window.onload = function () {
for (i in Names)
{
document.body.innerHTML = document.body.innerHTML.myReplace(Names[i], "Somebody");
}
}
如果Names太长的话,onload时间也边长,Names也就只能短小精悍。肯定存在更为有效的方法,只不过见识还未足够。
参考:
https://www.cnblogs.com/liuxianan/p/chrome-plugin-develop.html
翻译练手
About ten years ago, Baidu has been the front page of my browser. It was very handful. However, it became difficult to find information from other useless junks, not to mention its recommendations on the right side.
Somebody got cheated/married/divorced/ or whatever. I really do not care.
The simplest and direct method is to add the filters to Adblock on Chrome.
baidu.com###content_right
baidu.com##.cr-offset
To not seeing their names, I wrote some lines. When Names becomes too long, the duration of onload becomes longer. So, currently, I am keeping the array short.
var Names = new Array("范冰冰","王思聪","孙杨","李晨","迪丽热巴","宁泽涛","傅园慧","鄢军","周立波","贾乃亮","火箭少女","吴亦凡","鹿晗","关晓彤","逐梦演艺圈","科比","李易峰","杨洋");
String.prototype.myReplace = function(f,e) {
var reg=new RegExp(f,"g");
return this.replace(reg,e);
};
window.onload = function () {
for (i in Names)
{
document.body.innerHTML = document.body.innerHTML.myReplace(Names[i], "Somebody");
}
}