ExplicitMessage_Inject

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

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

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

/**
 * ExplicitMessage_Inject
 * @file [DEBUG] 信息显式化(注入版)
 * @version 1.2.2.20210905
 * @author Laster2800
 */

(function() {
  'use strict'

  let updateAlerted = false
  const injectVersion = 20210720
  for (const n of ['log', 'warn', 'error']) {
    const log = console[n]
    console[n] = function() {
      if (unsafeWindow.gm429521?.fn?.wrappedLog) {
        const gm = unsafeWindow.gm429521
        if (injectVersion != gm.injectUpdate) {
          if (!updateAlerted) {
            updateAlerted = true
            gm.fn.updateCheck?.(GM_info.script.name, injectVersion > gm.injectUpdate)
          }
          console[n] = log
        } else {
          console[n] = gm.fn.wrappedLog(console, log, n.toUpperCase(), GM_info.script.name)
        }
        console[n].apply(console, arguments)
      } else {
        log.apply(console, arguments)
      }
    }
  }
})()

QingJ © 2025

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