A1.js 916 B

12345678910111213141516171819202122232425262728293031
  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. // @require https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
  10. // ==/UserScript==
  11. function sleep(time) {
  12. return new Promise((resolve) => setTimeout(resolve, time));
  13. }
  14. async function getDom(sel) {
  15. for (let i = 0; i < 100; i++) {
  16. let dom = document.querySelector(sel);
  17. console.log(dom);
  18. if (dom) {
  19. return dom;
  20. } else {
  21. await sleep(100);
  22. }
  23. }
  24. }
  25. (async () => {
  26. let a_href = (await getDom("#notion-app")).href;
  27. (await getDom("#notion-app ")).click();
  28. let sel = "#notion-app";
  29. let a_input = await getDom(sel);
  30. a_input.value = a_href;
  31. })();