Inspect

Inspects a website.

  1. // ==UserScript==
  2. // @name Inspect
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Inspects a website.
  6. // @author cool
  7. // @match *://*/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function(w) {
  15. 'use strict';
  16. var link = document.createElement("link");
  17. link.id = "inspect-hljs-css";
  18. link.rel = "stylesheet";
  19. link.type = "text/css";
  20. link.href = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css";
  21. link.media = "all";
  22. document.getElementsByTagName("head")[0].appendChild(link);
  23. var bi = false;
  24. var ib = document.createElement("button");
  25. ib.setAttribute("style", "width: 80px !important; height: 40px !important; padding: 0px !important; margin: 0px !important; font-size: 14px !important; background-color: dodgerblue !important; color: white !important; border: none !important; border-radius: 5px 0px 5px 0px !important; position: fixed !important; right: 0px !important; bottom: 0px !important; z-index: 99999999 !important; cursor: pointer !important; font-family: Arial !important;");
  26. ib.innerHTML = "Inspect";
  27. document.body.appendChild(ib);
  28. var c = document.createElement("div");
  29. c.hidden = true;
  30. c.setAttribute("style", "width: 100% !important; height: 100% !important; padding: 0px !important; margin: 0px !important; font-size: 14px !important; background-color: lightgray !important; color: black !important; border: none !important; border-radius: 0px !important; position: fixed !important; left: 0px !important; top: 0px !important; z-index: 99999998 !important; cursor: auto !important; font-family: courier !important; user-select: text !important; overflow: auto;");
  31. document.body.appendChild(c);
  32. var co = document.createElement("button");
  33. co.setAttribute("style", "width: 80px !important; height: 20px !important; padding: 0px !important; margin: 0px !important; font-size: 12px !important; background-color: gray !important; color: white !important; border: none !important; border-radius: 0px 5px 0px 5px !important; position: fixed !important; right: 0px !important; top: 0px !important; z-index: 99999999 !important; cursor: pointer !important; font-family: Arial !important;");
  34. co.hidden = true;
  35. co.innerHTML = "Copy";
  36. document.body.appendChild(co);
  37. var pre = document.createElement("pre");
  38. var code = document.createElement("code");
  39. code.class = "language-html";
  40. pre.appendChild(code);
  41. c.appendChild(pre);
  42. var p = "";
  43. ib.addEventListener("click", function() {
  44. if (bi) {
  45. bi = false;
  46. ib.innerHTML = "Inspect";
  47. c.hidden = true;
  48. co.hidden = true;
  49. } else {
  50. bi = true;
  51. ib.innerHTML = "Close";
  52. c.hidden = false;
  53. co.hidden = false;
  54. }
  55. });
  56. co.addEventListener("click", function() {
  57. navigator.clipboard.writeText(code.textContent).then(() => {
  58. co.textContent = "Copied!";
  59. setTimeout(function() {
  60. co.textContent = "Copy";
  61. }, 2000);
  62. }).catch(() => {
  63. co.textContent = "Failed to copy!";
  64. setTimeout(function() {
  65. co.textContent = "Copy";
  66. }, 2000);
  67. });
  68. });
  69. setInterval(function() {
  70. if (document.documentElement.outerHTML != p) {
  71. code.textContent = document.documentElement.outerHTML;
  72. hljs.highlightAll();
  73. }
  74. p = document.documentElement.outerHTML;
  75. }, 250);
  76. })(window);

QingJ © 2025

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