Download with Mod Organizer

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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>";
			}
		}
	}
}