ExplicitMessage_Inject

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

21.01.2023 itibariyledir. En son verisyonu görün.

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greasyfork.org/scripts/429525/1140726/ExplicitMessage_Inject.js

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

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

(function() {
  'use strict'

  const win = typeof unsafeWindow === 'object' ? unsafeWindow : window
  const m = win[Symbol.for('ExplicitMessage')]
  if (!m?.fn?.wrappedLog) return
  if (typeof unsafeWindow !== 'object') {
    m.fn.explicit('注入版不支持 @grant none 脚本。此类脚本的日志使用主版本即可捕获。')
    return
  }
  let updateAlerted = false
  const injectVersion = 20230121
  const cs = console
  const fn = {}
  for (const k of ['log', 'debug', 'info', 'warn', 'error']) {
    const log = cs[k]
    fn[k] = (...args) => { // 首次执行进行初始化
      if (injectVersion !== m.injectUpdate) {
        if (!updateAlerted) {
          updateAlerted = true
          m.fn.updateCheck?.(GM_info.script.name, injectVersion > m.injectUpdate)
        }
        fn[k] = log
      } else {
        // 替换初始化方法,以后执行直接调用封装日志方法
        fn[k] = m.fn.wrappedLog(cs, log, k.toUpperCase(), GM_info.script.name)
      }
      Reflect.apply(fn[k], cs, args)
    }
  }

  // 日志方法可能会被包括脚本管理器在内的第三方定义为 configurable: false 属性,
  // 因而只能采取最稳定可靠的 Proxy 方案。
  // 此处 console(至少)是脚本管理器提供的代理控制台对象,并非全局 console。
  // eslint-disable-next-line no-global-assign
  console = new Proxy(cs, { get: (o, p) => (p in fn ? fn[p] : o[p]) })
})()