Greasy Fork is available in English.
自动关闭Minecraft官网的“前往##版”弹窗
- // ==UserScript==// @name 自动关闭Minecraft官网##版弹窗// @name:zh-CN 自动关闭Minecraft官网##版弹窗// @name:zh-TW 自動關閉Minecraft官網##版彈窗// @name:en Automatically close the Minecraft Netease Edition pop-up window of the Minecraft official website// @namespace http://github.com/lingbopro/auto-close-netease-popup/// @supportURL http://github.com/lingbopro/auto-close-netease-popup/// @version 1.0// @description 自动关闭Minecraft官网的“前往##版”弹窗// @description:zh-CN 自动关闭Minecraft官网的“前往##版”弹窗// @description:zh-TW 自動關閉Minecraft官網的「前往##版」彈窗// @description:en Automatically close the "Go to ##### Edition" pop-up window on the official Minecraft website// @author lingbopro// @license MIT// @match *://www.minecraft.net/*// @connect minecraft.net// @icon https://www.minecraft.net/etc.clientlibs/minecraft/clientlibs/main/resources/favicon.ico// @grant none// @run-at document-body// @noframes// ==/UserScript==(function() {'use strict';console.log("欢迎使用脚本「自动关闭Minecraft官网##版弹窗」!");let runtimeCounter = 0; //防止运行次数过多所以设定变量记录运行次数setTimeout(function(){ //由于弹窗可能不在页面加载第一时间显示,所以尝试多次runtimeCounter += 1;console.debug(`第 ${runtimeCounter} 次尝试`);if(document.body.classList.contains("modal-open")) {document.body.classList.remove("modal-open"); //修改body的类名使页面可滚动}let popup = document.getElementById("netease-promotion-modal"); //获取弹窗元素if(!(typeof(popup) == "undefined" || popup == null)) { //判断元素是否存在popup.remove(); //如果存在就去除console.log("成功去除网易弹窗~");return; //结束执行}else {if(runtimeCounter >= 10) { //如果运行多次还是不行也停止console.error("尝试多次依然不能去除弹窗啊...");return;}setTimeout(this,100); //如果去除不成功就重试}},20);})();