web-history.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // ==UserScript==
  2. // @name T-All-历史记录
  3. // @author tianyunperfect
  4. // @description 简介
  5. // @version 1.0.0
  6. // @update 2021-07-08 16:16:14
  7. // @match *://*/*
  8. // @require https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/tmp/monkey/util.js?a=2022年05月15日
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
  10. // ==/UserScript==
  11. (async () => {
  12. function save() {
  13. if (window.top.location.href == window.location.href) {
  14. axios.post(`https://web_history.tianyunperfect.cn/history/insert`, {
  15. "title": document.title,
  16. "url": location.href,
  17. "user_id": 1
  18. }).then(res => {
  19. console.log(res.data);
  20. });
  21. }
  22. }
  23. setTimeout(() => {
  24. let t_href = "t_href"
  25. localStorage.setItem(t_href, document.title);
  26. save();
  27. setInterval(() => {
  28. if (localStorage.getItem(t_href) !== document.title) {
  29. localStorage.setItem(t_href, document.title);
  30. save();
  31. }
  32. }, 5000)
  33. }, 3000)
  34. })();