tianyunperfect 3 rokov pred
rodič
commit
2302a97a85
1 zmenil súbory, kde vykonal 19 pridanie a 3 odobranie
  1. 19 3
      tmp/monkey/web-history.js

+ 19 - 3
tmp/monkey/web-history.js

@@ -10,12 +10,28 @@
 
 // ==/UserScript==
 (async () => {
-    setTimeout(()=> {
+    function save() {
         if (window.top.location.href == window.location.href) {
-            axios.get(`https://web_history.tianyunperfect.cn/history/insert?title=${document.title}&url=${location.href}`).then(res => {
+            axios.get(`https://web_history.tianyunperfect.cn/history/insert`, {
+                "title": document.title,
+                "url": location.href,
+                "user_id": 1
+            }).then(res => {
                 console.log(res.data);
             });
         }
-    },3000)
+    }
+
+    setTimeout(() => {
+        let t_href = "t_href"
+        localStorage.setItem(t_href, location.href);
+        save();
+        setInterval(() => {
+            if (localStorage.getItem(t_href) !== location.href) {
+                localStorage.setItem(t_href, location.href);
+                save();
+            }
+        }, 5000)
+    }, 3000)
 
 })();