百度贴吧隐私保护
效果:可以遮盖百度贴吧首页“爱逛的吧”,并且带开关按钮(写来玩、练手的):
// ==UserScript==
// @name 百度贴吧隐私保护
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 遮盖“爱逛的吧”
// @author harglo
// @match https://tieba.baidu.com
// @match https://tieba.baidu.com/index.html
// @grant none
// ==/UserScript==
javascript: (function() {
function f() {
count = count + 1;
if (count % 2 == 0) {
d2.style.visibility = "visible";
d3.style.backgroundColor="#5FB878";
} else {
d2.style.visibility = "hidden";
d3.style.backgroundColor="#FF5722";
}
}
var d1 = document.getElementsByClassName('u-f-w')[0];
d1.style.position="relative";
var d2 = document.createElement('div');
d2.style.cssText = "width:208px;height:202px;border: 1px solid #CDCDCD;background:#F6F7FB; position:absolute; top:0px; left:0; z-index:999;font-size:20px;text-align:center;line-height:202px;";
d1.appendChild(d2);
var t2=document.createTextNode("已经隐藏");
d2.appendChild(t2);
var count=0;
var d3=document.createElement("div");
d3.style.cssText="width:30px;height:30px;border-radius:3px;background-color:#5FB878;position:absolute;left:229px;top:543px;z-index:999;cursor:pointer;color:white;text-align:center;font-size:10px;line-height:30px";
var body=document.body;
body.appendChild(d3);
var t1=document.createTextNode("开关");
d3.appendChild(t1);
d3.onclick=f;
})();
使用:新建js文件,写入以下代码,再导入到油猴插件即可。