Advertisement
NullBy7e

NexusMods Automatic Endorse

Dec 6th, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //run script at: http://www.nexusmods.com/games/mods/completehistory/
  2.  
  3. //1) paste this script in your browser console and press ENTER, READ:
  4. //2) this will endorse all mods on the current mod history page that are not yet endorsed or abstained
  5. //3) the process is automatic, if you get alert windows, just hide them and refresh the page
  6. //4) popups are closed automatically (not done by script, must be a side effect)
  7. //5) if the html changes, or nexus adjusts their way of handling endorsements, this script will break
  8.  
  9. //USE AT YOUR OWN RISK!
  10. //USE AT YOUR OWN RISK!
  11. //USE AT YOUR OWN RISK!
  12.  
  13. $(function() {
  14.     //Nexus uses a special kind of ID/hash/whatever as params to the endorse function, let's find them!
  15.     var firstEndorseFunctionCall = $("span.file-rating a[onclick]:first").attr("onclick");
  16.     var endorseFunctionId = firstEndorseFunctionCall.split(',')[1];
  17.     var endorseFunctionId2 = firstEndorseFunctionCall.split(',')[2].split("_")[3].slice(0, -1);
  18.  
  19.     console.log("endorseFunctionId: " + endorseFunctionId);
  20.     console.log("endorseFunctionId2: " + endorseFunctionId2);
  21.  
  22.     //grab a list of all mod links on the current page (http://www.nexusmods.com/games/mods/completehistory/?page=X)
  23.     var thumbsUp = "https://staticdelivery.nexusmods.com/contents/images/icons/thumb_up.png";
  24.     var modIds = [];   
  25.     var modLinks = $("div#left-col").find("span.file-name a").map(function() {
  26.            return this.href;
  27.     }).get();
  28.  
  29.     //iterate through the result and parse the mod IDs
  30.     for(var i = 0; i < modLinks.length; i++) {
  31.         var id = modLinks[i].split('/')[5]; //5x '/' so we need idx number 5.
  32.         var selector = "img[id^=\"img_end_"+ id +"\"]";
  33.  
  34.         if($(selector).length && $(selector).attr("src") === thumbsUp) { //make sure that the mod isn't already endorsed or abstained
  35.            modIds.push(id);
  36.         }
  37.     }
  38.  
  39.     //start mass endorse!
  40.     for(var i = 0; i < modIds.length; i++) {
  41.         console.log("Endorsing mod " + modIds[i] + ".");
  42.         endorse_mod(modIds[i],endorseFunctionId,'img_end_'+ modIds[i] +'_' + endorseFunctionId2, endorseFunctionId2, false, 0, 1, 'h2');
  43.     }
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement