Greasy Fork 还支持 简体中文。

Chrome DevTools console

execute "console.log()" and "console.dir()" faster in the DevTool of Chrome

目前為 2022-12-11 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Chrome DevTools console
  3. // @description execute "console.log()" and "console.dir()" faster in the DevTool of Chrome
  4. // @author yeshiqing
  5. // @license MIT
  6. // @run-at document-idle
  7. // @match *
  8. // @grant none
  9. // @version 0.0.1
  10. // @namespace https://github.com/yeshiqing/tampermonkey-scripts
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
  12. // ==/UserScript==
  13.  
  14. let isFn = function (x) { return (x instanceof Function) }
  15.  
  16. let generate_console = function (...props) {
  17. props.forEach((prop, i) => {
  18. let raw = window[prop]
  19. let raw_isFn = isFn(raw)
  20. if (raw == null || raw_isFn) {
  21. window[prop] = function (...args) {
  22. raw && raw_isFn && raw()
  23. console[prop](...args)
  24. }
  25. }
  26. })
  27. }
  28.  
  29. let extend_Object_prototype = function (props) {
  30. props.forEach((prop, i) => {
  31. if (Object.prototype[prop] == null) {
  32. Object.prototype[prop] = function () {
  33. console[prop](this)
  34. }
  35. }
  36. })
  37. }
  38.  
  39. generate_console('log', 'dir')
  40.  
  41. extend_Object_prototype('log', 'dir')