ExplicitMessage_Inject

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

As of 2021-09-05. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/429525/967483/ExplicitMessage_Inject.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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

(function() {
  'use strict'

  let updateAlerted = false
  const injectVersion = 20210905
  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)
      }
    }
  }
})()