跳过minecraftforge.net上的adfoc跳转链接 || Skip adfoc link on minecraftforge.net

跳过minecraftforge.net上的adfoc跳转链接,直接下载文件

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           跳过minecraftforge.net上的adfoc跳转链接 || Skip adfoc link on minecraftforge.net
// @name:zh        跳过minecraftforge.net上的adfoc跳转链接
// @name:en        Skip adfoc link on minecraftforge.net
// @description    跳过minecraftforge.net上的adfoc跳转链接,直接下载文件
// @description:zh 跳过minecraftforge.net上的adfoc跳转链接,直接下载文件
// @description:en Skip adfoc link on minecraftforge.net and download files directly
// @namespace      myitian.mc-forge.skip-adfoc
// @version        1.1
// @license        MIT
// @author         Myitian
// @match          *.minecraftforge.net/*
// @grant          none
// ==/UserScript==

window.onload=function linkReplacerX(){
    var ele_a=document.getElementsByTagName('A');
    var reg_a=/https:\/\/adfoc\.us\/serve\/sitelinks\/\?(?:\S+=\S+&)?url=(\S+)/i;
    for(var i=0; i<ele_a.length; i++){
        var match=reg_a.exec(ele_a[i].href);
        if(match){
            ele_a[i].href=match[1];
        }
    }
}
window.onclick=function linkReplacerY(){
    var ele_a=document.getElementsByTagName('A');
    var reg_a=/https:\/\/adfoc\.us\/serve\/sitelinks\/\?(?:\S+=\S+&)?url=(\S+)/i;
    for(var i=0; i<ele_a.length; i++){
        var match=reg_a.exec(ele_a[i].href);
        if(match){
            ele_a[i].href=match[1];
        }
    }
}
window.onmousedown=function linkReplacerZ(){
    var ele_a=document.getElementsByTagName('A');
    var reg_a=/https:\/\/adfoc\.us\/serve\/sitelinks\/\?(?:\S+=\S+&)?url=(\S+)/i;
    for(var i=0; i<ele_a.length; i++){
        var match=reg_a.exec(ele_a[i].href);
        if(match){
            ele_a[i].href=match[1];
        }
    }
}