Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links

Redirects old oblivion nexus links to the proper place

当前为 2019-10-05 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @id           _Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links
// @name         Redirect Old Oblivion / Skyrim Nexus Mods and Tesnexus Links
// @namespace    https://greasyfork.org/en/scripts/10817-redirect-old-oblivion-nexus-mods-links
// @icon         http://www.nexusmods.com/favicon.ico
// @version      2.0
// @description  Redirects old oblivion nexus links to the proper place
// @author       Tyler Lester
// @include      http://*.nexusmods.com/mods/*
// @include      https://*.nexusmods.com/mods/*
// @include      http://*.nexusmods.com/users/*
// @include      https://*.nexusmods.com/users/*
// @include      http://www.tesnexus.com/downloads/file.php?id=*
// @include      https://www.tesnexus.com/downloads/file.php?id=*
// @include      http://www.nexusmods.com/?id=*
// @include      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;
    }
}