李恒道 发表于 2024-6-20 10:30:36

ConsoleBan过滤脚本

原本例子https://github.com/fz6m/console-ban

```
<head>
<!-- ... -->
<script src="https://cdn.jsdelivr.net/npm/console-ban@5.0.0/dist/console-ban.min.js"></script>
<script>
    // default options
    ConsoleBan.init()
    // custom options
    ConsoleBan.init({
      redirect: '/404'
    })
</script>
</head>
```
观察源码
```
!function(e, t) {
    "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).ConsoleBan = {})
}(this, (function(e) {
```
直接起手秒
```
// ==UserScript==
// @name         New Userscript
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @descriptiontry to take over the world!
// @author       You
// @match      http://c.gb688.cn/bzgk/gb/*
// @run-at       document-start
// @grant      unsafeWindow
// ==/UserScript==
Object.defineProperty(unsafeWindow,"ConsoleBan",{
    get:()=>{
      return {init:()=>{}}
    },
})
```

王一之 发表于 2024-6-20 11:41:50

这啥?有啥用

李恒道 发表于 2024-6-20 13:53:27

王一之 发表于 2024-6-20 11:41
这啥?有啥用

解答https://bbs.tampermonkey.net.cn/thread-7224-1-1.html
的问题分析
页: [1]
查看完整版本: ConsoleBan过滤脚本