Notion Helper

try to take over the world!

当前为 2020-11-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Notion Helper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://www.notion.so/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. "use strict";
  13. const initToc = () => {
  14. const toc = document.querySelector(".notion-table_of_contents-block").cloneNode(true);
  15. toc.style.boxSizing = "border-box";
  16. toc.style.width = "auto";
  17. toc.style.height = "calc(100% - 160px)";
  18. toc.style.overflowY = "scroll";
  19. toc.style.position = "fixed";
  20. toc.style.top = "50%";
  21. toc.style.left = "50%";
  22. toc.style.zIndex = 1;
  23. toc.style.transform = "translate(400px, -50%)";
  24. document.body.appendChild(toc);
  25. };
  26.  
  27. const isTocLoaded = () => document.querySelector(".notion-table_of_contents-block");
  28.  
  29. const timer = setInterval(() => {
  30. console.log("bibobiboi");
  31. if (isTocLoaded()) {
  32. clearInterval(timer);
  33. initToc();
  34. }
  35. }, 1000);
  36. })();