Greasy Fork

Greasy Fork is available in English.

g

gy

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         g
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  gy
// @author       You
// @include      http://p.gygpm.com/m/*
// @grant        none
// ==/UserScript==
function onInserted(selector, action) {
  if (document.querySelector(selector).length > 0) {
    console.log(
      document.querySelector(selector).length +
        " " +
        selector +
        " is loaded at begin"
    );
    action.call(document.querySelector(selector));
  }
  var reaction = function () {
    if (document.querySelector(selector).length > 0) {
      console.log(
        document.querySelector(selector).length + " " + selector + " is loaded"
      );
      action.call(document.querySelector(selector));
    }
  };

  var MutationObserver =
    window.MutationObserver ||
    window.WebKitMutationObserver ||
    window.MozMutationObserver;
  if (MutationObserver) {
    var observer = new MutationObserver(reaction);
    observer.observe(document.body, {
      childList: true,
      subtree: true,
    });
  } else {
    //setInterval(reaction, 100);
  }
}
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);
}

var action = function () {
  console.log(location.href);
  if (location.href.match("http://p.gygpm.com/m/#/goodsDetails")) {
    if (document.querySelector(".van-button__text")) {
      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")) {
    if (
      document.querySelector(".payNow") &&
      document.querySelector(".payNow").innerText == "已抢拍"
    )
      setTimeout(() => {
        window.history.go(-1);
      }, 300 + Math.floor(Math.random() * 300));
  }
};

var MutationObserver =
  window.MutationObserver ||
  window.WebKitMutationObserver ||
  window.MozMutationObserver;
if (MutationObserver) {
  var observer = new MutationObserver(action);
  observer.observe(document.body, {
    childList: true,
    subtree: true,
  });
}