ExplicitMessage_Inject

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

目前為 2021-09-25 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/429525/973724/ExplicitMessage_Inject.js

  1. /**
  2. * ExplicitMessage_Inject
  3. * @file [DEBUG] 信息显式化(注入版)
  4. * @version 1.3.1.20210925
  5. * @author Laster2800
  6. */
  7.  
  8. (function() {
  9. 'use strict'
  10.  
  11. let updateAlerted = false
  12. const injectVersion = 20210925
  13. for (const n of ['log', 'debug', 'info', 'warn', 'error']) {
  14. const log = console[n]
  15. console[n] = function() {
  16. if (unsafeWindow.gm429521?.fn?.wrappedLog) {
  17. const gm = unsafeWindow.gm429521
  18. if (injectVersion !== gm.injectUpdate) {
  19. if (!updateAlerted) {
  20. updateAlerted = true
  21. gm.fn.updateCheck?.(GM_info.script.name, injectVersion > gm.injectUpdate)
  22. }
  23. console[n] = log
  24. } else {
  25. console[n] = gm.fn.wrappedLog(console, log, n.toUpperCase(), GM_info.script.name)
  26. }
  27. Reflect.apply(console[n], console, arguments)
  28. } else {
  29. Reflect.apply(log, console, arguments)
  30. }
  31. }
  32. }
  33. })()

QingJ © 2025

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