Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links

Redirects old oblivion nexus links to the proper place

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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;
    }
}