Greasy Fork

Greasy Fork is available in English.

我的世界去除跳转网易提示

去掉网易跳转提示提示

当前为 2024-05-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name       我的世界去除跳转网易提示
// @namespace  https://github.com/marioplus/minecraft-net-easy-tips-remover
// @version    1.0.1
// @author     marioplus
// @license    GPL-3.0
// @icon       https://www.google.com/s2/favicons?sz=64&domain=minecraft.net
// @match      https://www.minecraft.net/*
// @run-at     document-start
// @description 去掉网易跳转提示提示
// ==/UserScript==

(function () {
  'use strict';

  var __defProp = Object.defineProperty;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __publicField = (obj, key, value) => {
    __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
    return value;
  };
  class ElementCreateListener {
    constructor(mode = "auto") {
      __publicField(this, "_observer");
      __publicField(this, "_mHandlers", /* @__PURE__ */ new Map());
      __publicField(this, "status", "stop");
      __publicField(this, "mode");
      this.mode = mode;
      this._observer = new MutationObserver((mutations) => mutations.forEach((mutation) => {
        if (mutation.type !== "childList") {
          return;
        }
        if (mutation.target.nodeType !== Node.ELEMENT_NODE) {
          return;
        }
        if (mutation.addedNodes.length === 0) {
          return;
        }
        Object.values(mutation.addedNodes).filter((node) => node.nodeType === Node.ELEMENT_NODE && node instanceof HTMLElement).forEach((node) => {
          const addElement = node;
          this._mHandlers.forEach((handler, selector) => {
            if (addElement.matches(selector)) {
              handler(addElement, selector, addElement);
            }
          });
        });
      }));
    }
    register(selector, callback) {
      this._mHandlers.set(selector, callback);
      if (this.mode === "auto") {
        this.start();
      }
      return this;
    }
    unregister(...selectors2) {
      selectors2.forEach((selector) => this._mHandlers.delete(selector));
      if (this._mHandlers.size === 0) {
        this.stop();
      }
      return this;
    }
    clear() {
      this._mHandlers.clear();
      this.stop();
      return this;
    }
    start() {
      if (this.status === "stop") {
        this.status = "start";
        this._observer.observe(document.documentElement, { childList: true, subtree: true });
      }
      return this;
    }
    stop() {
      this.status = "stop";
      this._observer.disconnect();
      return this;
    }
    stopTimeout(timeout) {
      setTimeout(() => this.stop(), timeout);
      return this;
    }
  }
  function doSkip(el) {
    el == null ? void 0 : el.click();
  }
  const selectors = [
    "#netease-promotion-modal button#popup-btn.btn.btn-link",
    'button[aria-label="继续浏览该网站"]'
  ];
  const listener = new ElementCreateListener("auto").stopTimeout(1e3 * 10);
  selectors.forEach((selector) => {
    document.querySelectorAll(selector).forEach((el) => doSkip(el));
    listener.register(selector, (el) => doSkip(el));
  });

})();