Greasy Fork

Greasy Fork is available in English.

g

gy

当前为 2021-08-04 提交的版本,查看 最新版本

// ==UserScript==
// @name         g
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  gy
// @author       You
// @include      http://p.gygpm.com/m/*
// @grant        none
// ==/UserScript==

function onLoaded(selector, action) {
  var target = this;
  if (document.querySelector(selector).length > 0) {
    console.log(
      document.querySelector(selector).length + " " + selector + " is loaded"
    );
    action();
  } else
    setTimeout(function () {
      onLoaded(selector, action);
    }, 10);
}

window.onhashchange = function () {
  if (location.href.match("http://p.gygpm.com/m/#/goodsDetails")) {
    var check = setInterval(function () {
      myTimer();
    }, 10);
    function myTimer() {
      if (document.querySelector(".van-button__text")) {
        clearInterval(check);
        if (
          document.querySelector(".van-button__text").innerText == "交易中" ||
          document.querySelector(".van-button__text").innerText == "已售罄" ||
          document.querySelector(".van-button__text").innerText ==
            "还未开始,请耐心等待"
        ) {
          console.log(document.querySelector(".van-button__text").innerText);
          setTimeout(() => {
            window.history.go(-1);
          }, 300 + Math.floor(Math.random() * 300));
        }
      }
    }
  }

  if (location.href.match("http://p.gygpm.com/m/#/payOrder")) {
    var check2 = setInterval(function () {
      myTimer2();
    }, 10);
    function myTimer2() {
      if (document.querySelector(".van-button__text")) {
        clearInterval(check2);
        if (document.querySelector(".payNow").innerText == "已抢拍")
          setTimeout(() => {
            window.history.go(-1);
          }, 300 + Math.floor(Math.random() * 300));
      }
    }
  }
};