自动屏蔽网站的元素
经常看到一些网站有不友好的内容,现在可以结合chrome的扩展工具,动态进行修改。
- 最简单的方式,用Adblock plus,可以自动block页面元素。
- 如果要更进一步动态修改,可以安装chrome 扩展工具:篡改猴,下载地址:https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo,可以自己编辑js代码动态修改页面内容。
我写了一个测试脚本,基本上可以满足要求
// UserScript
// @name sobooks.cc
// @namespace http://tampermonkey.net/
// @version 2025-11-15
// @description try to take over the world!
// @author You
// @match https://sobooks.cc/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=sobooks.cc
// @grant none
// /UserScript
(function() {
'use strict';
// Your code here...
console.log(document.location);
setTimeout(function(){
document.body.removeAttribute('style');
},3000);
})();