tianyunperfect 3 vuotta sitten
vanhempi
commit
8bae966a0c
5 muutettua tiedostoa jossa 29 lisäystä ja 67 poistoa
  1. 2 0
      tmp/monkey/A1.js
  2. 23 0
      tmp/monkey/notion-字体修改.js
  3. 0 27
      tmp/monkey/tmp.js
  4. 0 37
      tmp/monkey/util.js
  5. 4 3
      tmp/monkey/web-history.js

+ 2 - 0
tmp/monkey/A1.js

@@ -6,6 +6,8 @@
 // @update            2021-07-08 16:16:14
 // @include           *www.baidu.com*
 // @require           https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/tmp/monkey/util.js?a=1
+// @require           https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.1/js.cookie.min.js
+
 
 // ==/UserScript==
 (async () => {

+ 23 - 0
tmp/monkey/notion-字体修改.js

@@ -0,0 +1,23 @@
+// ==UserScript==
+// @name              T-notion-字体修改
+// @author            tianyunperfect
+// @description       简介
+// @version           1.0.0
+// @update            2021-07-08 16:16:14
+// @include           https://*.notion.so/*
+// @require           https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/tmp/monkey/util.js?a=1
+// @require           https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.1/js.cookie.min.js
+
+// ==/UserScript==
+(async () => {
+    if (localStorage.getItem(location.href)) {
+        return;
+    } else {
+        localStorage.setItem(location.href, "true")
+    }
+    (await getDom("#notion-app > div > div.notion-cursor-listener.showHoverText > div:nth-child(2) > div:nth-child(1) > div.notion-topbar > div:nth-child(1) > div.notion-topbar-action-buttons > div:nth-child(2) > div.notion-topbar-more-button.notion-focusable")).click();
+    let font = (await getDom("#notion-app > div > div.notion-overlay-container.notion-default-overlay-container > div:nth-child(2) > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div > div > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2)"));
+    if (font) {
+        font.click();
+    }
+})();

+ 0 - 27
tmp/monkey/tmp.js

@@ -1,27 +0,0 @@
-// ==UserScript==
-// @name              T-美妆-爬虫
-// @author            tianyunperfect
-// @description       简介
-// @version           1.0.0
-// @update            2021-07-08 16:16:14
-// @grant             GM_registerMenuCommand
-// @include           https://bebd.bevol.com/ranking?type=category
-// @require           https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/tmp/monkey/util.js?a=1
-// @require     https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
-
-// ==/UserScript==
-(async () => {
-    GM_registerMenuCommand("!!!复制并加到memory", do1);
-    async function do1 () {
-        let res =[]
-        let rows = (await getDomAll(".ant-table-tbody [data-row-key]"))
-        for (let x in rows) {
-            if (x < 50) {
-                res.push(rows[x].getAttribute("data-row-key"));
-            }
-        }
-        console.log(res)
-    };
-
-
-})();

+ 0 - 37
tmp/monkey/util.js

@@ -162,43 +162,6 @@ function log(obj) {
 }
 
 
-/**
- * 设置 cookie
- * setCookie("a", "b", {"max_age": 10, 'path': "/"})
- * @param k
- * @param v
- * @param options
- */
-function setCookie(k, v, options) {
-    const kvTool = {
-        max_age: "max-age",  //过期的秒数
-        path: "path",
-        domain: "domain",
-        secure: "secure"
-    };
-
-    if (!options) {
-        document.cookie = k + "=" + v;
-    } else {
-        const tmp = [];
-        for (const key in options) {
-            tmp.push(kvTool[key] + "=" + options[key]);
-        }
-        document.cookie = k + "=" + v + "; " + tmp.join("; ");
-    }
-}
-
-function getCookie(k) {
-    const strCookie = document.cookie;
-    const kvs = strCookie.split(";").map(v => v.trim());
-    const objCookie = {};
-    kvs.forEach(v => {
-        const kv = v.split("=");
-        objCookie[kv[0]] = kv[1];
-    });
-    return objCookie[k];
-}
-
 function addJSFile(js_url) {
     const eleScript = document.createElement("script");
     eleScript.type = "text/javascript";

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

@@ -7,6 +7,7 @@
 // @match             *://*/*
 // @require           https://git.tianyunperfect.cn/tianyunperfect/web-base/raw/master/tmp/monkey/util.js?a=2022年05月15日
 // @require           https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
+// @require           https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.1/js.cookie.min.js
 
 // ==/UserScript==
 (async () => {
@@ -25,15 +26,15 @@
     }
 
     function getKey() {
-        return "t_href" + location.href;
+        return "t_href_" + location.href;
     }
 
     function setTitle() {
-        localStorage.setItem(getKey(), document.title);
+        Cookies.set(getKey(), document.title);
     }
 
     function checkTitle() {
-        return localStorage.getItem(getKey()) !== document.title
+        return Cookies.get(getKey()) !== document.title
     }
 
     setTimeout(() => {