Notion.so DOMLock bypass

Disable notion.so DOMLock, which prevents DOM modification from extensions.

当前为 2022-01-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Notion.so DOMLock bypass
  3. // @description Disable notion.so DOMLock, which prevents DOM modification from extensions.
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @author Sophie Saiada (sophies.dev)
  7. // @license MIT
  8. // @include https://www.notion.so/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. const lockAfterRenderRegex =
  14. /\W+at [a-zA-Z]+\.lockAfterRender \(https:\/\/www.notion.so\/app/;
  15. // eslint-disable-next-line no-proto
  16. const mutationObserverPrototype = MutationObserver.prototype;
  17. const originalObserve = mutationObserverPrototype.observe;
  18. mutationObserverPrototype.observe = function () {
  19. const stackLines = new Error().stack.split("\n");
  20. if (
  21. stackLines.some(function (line) {
  22. return line.match(lockAfterRenderRegex) !== null;
  23. })
  24. ) {
  25. return;
  26. }
  27. originalObserve.call(this, ...arguments);
  28. };
  29. })();

QingJ © 2025

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