Nexus Mod 助手

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

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

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

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

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

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