A1.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // ==UserScript==
  2. // @name T-网站-目的
  3. // @author tianyunperfect
  4. // @description 简介
  5. // @version 1.0.0
  6. // @update 2021-07-08 16:16:14
  7. // @include *www.baidu.com*
  8. // @include *tieba.baidu.com*
  9. // ==/UserScript==
  10. function sleep(time) {
  11. return new Promise((resolve) => setTimeout(resolve, time));
  12. }
  13. async function getDom(sel) {
  14. for (let i = 0; i < 100; i++) {
  15. let dom = document.querySelector(sel);
  16. console.log(dom);
  17. if (dom) {
  18. return dom;
  19. } else {
  20. await sleep(100);
  21. }
  22. }
  23. }
  24. (async () => {
  25. let a_href = (await getDom("#notion-app")).href;
  26. (await getDom("#notion-app ")).click();
  27. let sel = "#notion-app";
  28. let a_input = await getDom(sel);
  29. a_input.value = a_href;
  30. })();
  31. // =========添加css
  32. // ==UserScript==
  33. // @name T-Notion-样式
  34. // @namespace Violentmonkey Scripts
  35. // @match https://www.notion.so/tianyunperfect/*
  36. // @grant none
  37. // @version 1.0
  38. // @author -
  39. // @description 2021/9/30 下午3:02:18
  40. // ==/UserScript==
  41. (function(){
  42. $('head').append($(`
  43. <!-- CSS部分 -->
  44. <style>
  45. #notion-app > div > div.notion-cursor-listener.showHoverText > div:nth-child(2) > div.notion-frame.notionX-notionCenter > div.notion-scroller.vertical.horizontal > div:nth-child(2) > div{
  46. width: 100% !important;
  47. }
  48. #notion-app > div > div.notion-cursor-listener.showHoverText > div:nth-child(2) > div.notion-frame.notionX-notionCenter > div.notion-scroller.vertical.horizontal > div:nth-child(2) > div > div:nth-child(1) > div > div:nth-child(1) > div.notion-record-icon.notranslate.notion-focusable{
  49. margin-top: 0 !important;
  50. }
  51. .notion-page-controls{
  52. margin-top: 0 !important;
  53. }
  54. </style>`));
  55. })();
  56. // @require https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
  57. // @require https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js