Greasy Fork 还支持 简体中文。

Open Source Shadow DOM

Ensure all Shadow DOM nodes are open. Intented for research use.

目前為 2022-06-23 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Open Source Shadow DOM
  3. // @namespace https://greasyfork.org/en/users/85671-jcunews
  4. // @version 1.0.1
  5. // @license AGPLv3
  6. // @author jcunews
  7. // @description Ensure all Shadow DOM nodes are open. Intented for research use.
  8. // @match *://*/*
  9. // @grant none
  10. // @inject-into page
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. (() => {
  15. var as = Element.prototype.attachShadow;
  16. Element.prototype.attachShadow = function(opts) {
  17. var o = {}, m = opts?.mode, r;
  18. Array.from(Object.entries(opts)).forEach(a => o[a[0]] = a[1]);
  19. o.mode = "open";
  20. opts = o;
  21. r = as.apply(this, arguments);
  22. if (m === "closed") {
  23. Object.defineProperty(r, "realMode", {value: "open"});
  24. Object.defineProperty(r, "mode", {
  25. get: () => "closed",
  26. set: v => v
  27. })
  28. }
  29. return r
  30. };
  31. })()