Download with Mod Organizer

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

  1. // ==UserScript==
  2. // @name Download with Mod Organizer
  3. // @description Nexus sites will better suit Mod Organizer users by replacing references to NMM with references to MO.
  4. // @version 1.0
  5. // @author Alex Bull
  6.  
  7. // @match http://*.nexusmods.com/*/mods/*
  8.  
  9. // @exclude http://*.nexusmods.com/*/mods/searchresults/*
  10. // @exclude http://*.nexusmods.com/*/mods/categories/*
  11. // @exclude http://*.nexusmods.com/*/mods/newtoday/*
  12. // @exclude http://*.nexusmods.com/*/mods/newrecently/*
  13. // @exclude http://*.nexusmods.com/*/mods/latestmods/*
  14. // @exclude http://*.nexusmods.com/*/mods/top/*
  15. // @exclude http://*.nexusmods.com/*/mods/tags/*
  16. // @exclude http://*.nexusmods.com/*/mods/modsofthemonth/*
  17. // @exclude http://*.nexusmods.com/*/mods/uploadwizard/*
  18. // @exclude http://*.nexusmods.com/*/mods/manage/*
  19. // @exclude http://*.nexusmods.com/*/mods/track/*
  20. // @exclude http://*.nexusmods.com/*/mods/history/*
  21.  
  22. // @namespace https://greasyfork.org/users/9217
  23. // ==/UserScript==
  24.  
  25. var validGames = ["Fallout3","NewVegas","Oblivion","Skyrim"];
  26.  
  27. var quickDownload_default = "Download (NMM)";
  28. var downloadButton_default = "Download with Manager";
  29.  
  30. var quickDownload = "Download (MO)";
  31. var downloadButton = "Download with Mod Organizer";
  32.  
  33. var tabLoaded;
  34. var allowedGame = false;
  35.  
  36. for (var i=0;i<validGames.length;i++) {
  37. if (window.location.href.indexOf("nexusmods.com/"+validGames[i].toLowerCase()+"/") > -1) {
  38. allowedGame = true;
  39. }
  40. }
  41.  
  42. if (allowedGame) {
  43. var quickDownloadButtons = document.getElementsByClassName("action-button green");
  44. if (quickDownloadButtons[0].children[0].innerHTML.toUpperCase() == quickDownload_default.toUpperCase()) {
  45. quickDownloadButtons[0].children[0].innerHTML = quickDownload;
  46. }
  47.  
  48. if(window.location.href.indexOf("modfiles") > -1) {
  49. tabLoaded = setInterval(function() {checkLoaded()}, 20);
  50. }
  51.  
  52. document.getElementById("tab2").onclick = function() {
  53. tabLoaded = setInterval(function() {checkLoaded()}, 20);
  54. }
  55.  
  56. function checkLoaded() {
  57. if (document.getElementsByClassName("download buttons").length >= 1) {
  58. modifyDownloadButtons();
  59. }
  60. }
  61. function modifyDownloadButtons() {
  62. clearInterval(tabLoaded);
  63. var downloadButtons = document.getElementsByClassName("download buttons");
  64. for (var i=0;i<downloadButtons.length;i++) {
  65. if (downloadButtons[i].children[0].innerHTML.toUpperCase() == "<SPAN>"+downloadButton_default.toUpperCase()+"</SPAN>") {
  66. downloadButtons[i].children[0].innerHTML = "<span>"+downloadButton+"</span>";
  67. }
  68. }
  69. }
  70. }