瀏覽代碼

分离工具类函数

tianyun 3 年之前
父節點
當前提交
8f39f940ec
共有 4 個文件被更改,包括 8 次插入83 次删除
  1. 3 48
      tmp/monkey/A1.js
  2. 1 15
      tmp/monkey/doc_qq.js
  3. 3 5
      tmp/monkey/notion-remove-add.js
  4. 1 15
      tmp/monkey/简书-自动点击阅读全文.js

+ 3 - 48
tmp/monkey/A1.js

@@ -5,61 +5,16 @@
 // @version           1.0.0
 // @version           1.0.0
 // @update            2021-07-08 16:16:14
 // @update            2021-07-08 16:16:14
 // @include           *www.baidu.com*
 // @include           *www.baidu.com*
-// @include           *tieba.baidu.com*
+// @require           http://www.tianyunperfect.cn:3001/tianyunperfect/web-base/raw/369c684a3d4f12d24ef0e6edacde733e3a6e2d00/tmp/monkey/util.js
 
 
 // ==/UserScript==
 // ==/UserScript==
-function sleep(time) {
-    return new Promise((resolve) => setTimeout(resolve, time));
-}
-async function getDom(sel) {
-    for (let i = 0; i < 100; i++) {
-        let dom = document.querySelector(sel);
-        console.log(dom);
-        if (dom) {
-            return dom;
-        } else {
-            await sleep(100);
-        }
-    }
-}
 (async () => {
 (async () => {
-    let a_href = (await getDom("#notion-app")).href;
-    (await getDom("#notion-app ")).click();
-    let sel = "#notion-app";
-    let a_input = await getDom(sel);
-    a_input.value = a_href;
-})();
-
-
-// =========添加css
 
 
-// ==UserScript==
-// @name        T-Notion-样式
-// @namespace   Violentmonkey Scripts
-// @match       https://www.notion.so/tianyunperfect/*
-// @grant       none
-// @version     1.0
-// @author      -
-// @description 2021/9/30 下午3:02:18
-// ==/UserScript==
-(function(){
-    $('head').append($(`
-    <!-- CSS部分 -->
-    <style>
-    #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{
-      width: 100% !important;
-    }
-    #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{
-      margin-top: 0 !important;
-    }
-    .notion-page-controls{
-      margin-top: 0 !important;
-    }
-  </style>`));
+    (await getDom("#notion-app ")).click();
 
 
+    addNewStyle('.box {height: 100px !important;}');
 })();
 })();
 
 
 
 
-
 // @require     https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
 // @require     https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
 // @require      https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
 // @require      https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js

+ 1 - 15
tmp/monkey/doc_qq.js

@@ -5,22 +5,8 @@
 // @version           1.0.0
 // @version           1.0.0
 // @update            2021-07-08 16:16:14
 // @update            2021-07-08 16:16:14
 // @include           https://docs.qq.com/sheet/*
 // @include           https://docs.qq.com/sheet/*
+// @require           http://www.tianyunperfect.cn:3001/tianyunperfect/web-base/raw/369c684a3d4f12d24ef0e6edacde733e3a6e2d00/tmp/monkey/util.js
 // ==/UserScript==
 // ==/UserScript==
-function sleep(time) {
-    return new Promise((resolve) => setTimeout(resolve, time));
-}
-
-async function getDom(sel) {
-    for (let i = 0; i < 200; i++) {
-        let dom = document.querySelector(sel);
-        console.log(dom);
-        if (dom) {
-            return dom;
-        } else {
-            await sleep(300);
-        }
-    }
-}
 
 
 (async () => {
 (async () => {
     (await getDom('.pc-slide[style="pointer-events: auto;"]')).click();
     (await getDom('.pc-slide[style="pointer-events: auto;"]')).click();

+ 3 - 5
tmp/monkey/notion-remove-add.js

@@ -6,16 +6,14 @@
 // @version     1.0
 // @version     1.0
 // @author      -
 // @author      -
 // @description 2021/9/30 下午3:02:18
 // @description 2021/9/30 下午3:02:18
-// @require      https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
+// @require      http://www.tianyunperfect.cn:3001/tianyunperfect/web-base/raw/369c684a3d4f12d24ef0e6edacde733e3a6e2d00/tmp/monkey/util.js
 // ==/UserScript==
 // ==/UserScript==
 (function(){
 (function(){
-    $('head').append($(`
-    <!-- CSS部分 -->
-    <style>
+    addNewStyle(`
     #notion-app > div > div.notion-cursor-listener.showHoverText > div:nth-child(2) > div.notion-frame > div.notion-scroller.vertical.horizontal > div:nth-child(3) > div > div > div > div > div > div:nth-child(2) > div > div.notion-focusable
     #notion-app > div > div.notion-cursor-listener.showHoverText > div:nth-child(2) > div.notion-frame > div.notion-scroller.vertical.horizontal > div:nth-child(3) > div > div > div > div > div > div:nth-child(2) > div > div.notion-focusable
     {
     {
     display: none !important;
     display: none !important;
     }
     }
-  </style>`));
+    `)
 
 
 })();
 })();

+ 1 - 15
tmp/monkey/简书-自动点击阅读全文.js

@@ -5,22 +5,8 @@
 // @version           1.0.0
 // @version           1.0.0
 // @update            2021年12月21日
 // @update            2021年12月21日
 // @include           https://www.jianshu.com/p/*
 // @include           https://www.jianshu.com/p/*
+// @require           http://www.tianyunperfect.cn:3001/tianyunperfect/web-base/raw/369c684a3d4f12d24ef0e6edacde733e3a6e2d00/tmp/monkey/util.js
 // ==/UserScript==
 // ==/UserScript==
-function sleep(time) {
-    return new Promise((resolve) => setTimeout(resolve, time));
-}
-
-async function getDom(sel) {
-    for (let i = 0; i < 100; i++) {
-        let dom = document.querySelector(sel);
-        console.log(dom);
-        if (dom) {
-            return dom;
-        } else {
-            await sleep(100);
-        }
-    }
-}
 
 
 (async () => {
 (async () => {
     (await getDom(".nP21pp")).click();
     (await getDom(".nP21pp")).click();