原本例子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
// @description try 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:()=>{}}
},
})