Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links

Redirects old oblivion nexus links to the proper place

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links
// @namespace    https://greasyfork.org/en/scripts/10817-redirect-old-oblivion-nexus-mods-links
// @icon         https://www.nexusmods.com/favicon.ico
// @version      2.1
// @description  Redirects old oblivion nexus links to the proper place
// @author       Axer128
// @match        http://*.nexusmods.com/mods/*
// @match        https://*.nexusmods.com/mods/*
// @match        http://*.nexusmods.com/users/*
// @match        https://*.nexusmods.com/users/*
// @match        http://www.tesnexus.com/downloads/file.php?id=*
// @match        https://www.tesnexus.com/downloads/file.php?id=*
// @match        http://www.nexusmods.com/?id=*
// @match        https://www.nexusmods.com/?id=*
// @grant        none
// @run-at       document-start

// ==/UserScript==
    // This is to ensure your browsers back button still works even with high script lag, might need to click back a few times
window.setTimeout(doRedirect, 750);

function doRedirect()
{
    // This one fixes very old oblivion links to tesnexus.com
    var url = new URL(window.location.href);
    var id = url.searchParams.get("id");
    if (id != null)
    {
        window.location.href="https://www.nexusmods.com/oblivion/mods/"+id;
    }
    // This one fixes oblivion.nexusmods.com
    else if (window.location.href.startsWith("https://oblivion.nexusmods.com/mods"))
    {
        window.location.href="https://www.nexusmods.com/oblivion"+window.location.pathname;
    }
     // This one fixes skyrim.nexusmods.com
    else if (window.location.href.startsWith("https://skyrim.nexusmods.com/mods"))
    {
        window.location.href="https://www.nexusmods.com/skyrim"+window.location.pathname;
    }
         // This one fixes morrowind.nexusmods.com
    else if (window.location.href.startsWith("https://morrowind.nexusmods.com/mods"))
    {
        window.location.href="https://www.nexusmods.com/morrowind"+window.location.pathname;
    }
}