Greasy Fork

Greasy Fork is available in English.

tapd

TAPD BUG自动提醒

当前为 2022-05-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         tapd
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  TAPD BUG自动提醒
// @author       You
// @match        https://www.tapd.cn/tapd_fe/63930006/bug/list?queryToken=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=1.228
// @grant        GM_xmlhttpRequest
// @license MIT
// ==/UserScript==

(async function () {
  let sleep = (time) =>
    new Promise((resolve) => {
      setTimeout(() => {
        resolve();
      }, time);
    });

  let sendMsg = ()=>{
    GM_xmlhttpRequest({
        method: "GET",
        url: "https://sctapi.ftqq.com/SCT91734THZBfRwhkRl5tdkxduyhRURxf.send?title=TAPD",
        onload: function(response) {
           //这里写处理函数
        }
      });
  }
  let changeColor = async (isMe) => {
    if(isMe){
        sendMsg()
    }
    document.body.style.background = isMe ? "red" : "yellow";
    await sleep(3000);
    document.body.style.background = 'white';
    await sleep(3000);
    await changeColor(isMe);
  };

  let waitForSelector = async (selector) => {
    let res = document.querySelector(selector);
    if (!res) {
      await sleep(500)
      await waitForSelector(selector);
    }
  };

  let selector = "td:nth-child(8)";
  await waitForSelector(selector);
  let arr = [...document.querySelectorAll(selector)].map(
    (one) => one.innerText
  );
  console.log(arr);
  let hasMe = arr.some((one) => one.indexOf("雷") !== -1);
  let hasCheng = arr.some((one) => one.indexOf("成") !== -1);
  if (hasMe || hasCheng) {
    changeColor(hasMe);
  }
  if (!hasMe) {
    await sleep(60000);
    location.reload();
  }
})();