Nexus Mod 助手

浏览网页时, 自动在 Nexus Mod 的超链接之后显示该 mod 的 Nexus ID

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Nexus Mod 助手
// @author       岚浅浅
// @description  浏览网页时, 自动在 Nexus Mod 的超链接之后显示该 mod 的 Nexus ID
// @namespace    http://tampermonkey.net/
// @homepageURL  https://github.com/LanQianqian/greasyForkScripts
// @version      1.0.0
// @include      *
// @grant        GM_addStyle
// @license      GPL-3.0 License
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/underscore.js/1.13.1/underscore.min.js
// ==/UserScript==
// jshint esversion: 6

$(function () {
    let hyperlinks = $('a');
    for (let hyperlink of hyperlinks) {
        let href = $(hyperlink).attr('href');
        if (!href) {
            continue;
        }
        let matches = href.match(/.*www.nexusmods.com\/.*\/mods\/(\d+).*/);
        if (!matches) {
            continue;
        }
        let nexusId = matches[1];
        $(hyperlink).after(' [' + nexusId + ']');
    }
});