ExplicitMessage_Inject

[DEBUG] 信息显式化(注入版)

当前为 2021-07-18 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/429525/951788/ExplicitMessage_Inject.js

  1. /**
  2. * ExplicitLog_Inject
  3. * @file [DEBUG] 显式日志(注入版)
  4. * @version 2.0.1.20210718
  5. * @author Laster2800
  6. */
  7.  
  8. (function() {
  9. const w = unsafeWindow
  10. const logs = ['log', 'warn', 'error']
  11. for (const log of logs) {
  12. const _ = console[log]
  13. console[log] = function() {
  14. if (w.gm429521?.config.enabled) {
  15. const m = [arguments, log.toUpperCase()]
  16. if (w.gm429521?.fn.match(m, w.gm429521?.config.include) && !w.gm429521?.fn.match(m, w.gm429521?.config.exclude)) {
  17. let msg = null
  18. if (arguments.length == 1) {
  19. if (typeof arguments[0] == 'object') {
  20. msg = JSON.stringify(arguments[0])
  21. } else {
  22. msg = arguments[0]
  23. }
  24. } else {
  25. msg = JSON.stringify(arguments)
  26. }
  27. w.gm429521?.fn.explicit(msg, log.toUpperCase(), GM_info.script.name)
  28. }
  29. }
  30. return _.apply(console, arguments)
  31. }
  32. }
  33. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址