Download with Mod Organizer

Nexus sites will better suit Mod Organizer users by replacing references to NMM with references to MO.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name       		Download with Mod Organizer
// @description  	Nexus sites will better suit Mod Organizer users by replacing references to NMM with references to MO.
// @version    		1.0
// @author			Alex Bull

// @match			http://*.nexusmods.com/*/mods/*

// @exclude			http://*.nexusmods.com/*/mods/searchresults/*
// @exclude			http://*.nexusmods.com/*/mods/categories/*
// @exclude			http://*.nexusmods.com/*/mods/newtoday/*
// @exclude			http://*.nexusmods.com/*/mods/newrecently/*
// @exclude			http://*.nexusmods.com/*/mods/latestmods/*
// @exclude			http://*.nexusmods.com/*/mods/top/*
// @exclude			http://*.nexusmods.com/*/mods/tags/*
// @exclude			http://*.nexusmods.com/*/mods/modsofthemonth/*
// @exclude			http://*.nexusmods.com/*/mods/uploadwizard/*
// @exclude			http://*.nexusmods.com/*/mods/manage/*
// @exclude			http://*.nexusmods.com/*/mods/track/*
// @exclude			http://*.nexusmods.com/*/mods/history/*

// @namespace https://greasyfork.org/users/9217
// ==/UserScript==

var validGames = ["Fallout3","NewVegas","Oblivion","Skyrim"];

var quickDownload_default = "Download (NMM)";
var downloadButton_default = "Download with Manager";

var quickDownload = "Download (MO)";
var downloadButton = "Download with Mod Organizer";

var tabLoaded;
var allowedGame = false;

for (var i=0;i<validGames.length;i++) {
    if (window.location.href.indexOf("nexusmods.com/"+validGames[i].toLowerCase()+"/") > -1) {
        allowedGame = true;
    }
}

if (allowedGame) {
	var quickDownloadButtons = document.getElementsByClassName("action-button green");
	if (quickDownloadButtons[0].children[0].innerHTML.toUpperCase() == quickDownload_default.toUpperCase()) {
		quickDownloadButtons[0].children[0].innerHTML = quickDownload;
	}

	if(window.location.href.indexOf("modfiles") > -1) {
		tabLoaded = setInterval(function() {checkLoaded()}, 20);
	}

	document.getElementById("tab2").onclick = function() {
		tabLoaded = setInterval(function() {checkLoaded()}, 20);
	}

	function checkLoaded() {
		if (document.getElementsByClassName("download buttons").length >= 1) {
			modifyDownloadButtons();
		}
	}
		
	function modifyDownloadButtons() {
		clearInterval(tabLoaded);           
		var downloadButtons = document.getElementsByClassName("download buttons");
		for (var i=0;i<downloadButtons.length;i++) {
			if (downloadButtons[i].children[0].innerHTML.toUpperCase() == "<SPAN>"+downloadButton_default.toUpperCase()+"</SPAN>") {
				downloadButtons[i].children[0].innerHTML = "<span>"+downloadButton+"</span>";
			}
		}
	}
}