CurseTweaks

Automatically applies the filters set in the Mods search to the mod's 'Download' button. The goal is to make downloads easier, taking the user to all the files compatible with the version of the Game he wants to play.

  1. // ==UserScript==
  2. // @name CurseTweaks
  3. // @version 9.0
  4. // @description Automatically applies the filters set in the Mods search to the mod's 'Download' button. The goal is to make downloads easier, taking the user to all the files compatible with the version of the Game he wants to play.
  5. // @icon https://www.google.com/s2/favicons?domain=curseforge.com
  6. // @author Diegiwg
  7. // @exclude https://www.curseforge.com/*/*/*/download/*
  8. // @exclude https://www.curseforge.com/*/*/*/files/*
  9. // @match https://www.curseforge.com/*/*?*
  10. // @match https://www.curseforge.com/*/*/*/download
  11. // @run-at document-start
  12. // @grant unsafeWindow
  13. // @namespace https://greasyfork.org/users/45177
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. var filterID; var checkURL = window.location.pathname;
  20. var down = checkURL.split('/')[4]; var urlALL = window.location.href; var index = urlALL.split('?')[0];
  21. var game = urlALL.split('/')[3]; var type = urlALL.split('/')[4]; var mod = urlALL.split('/')[5];
  22. if (down==='download'){
  23. function cookieREAD(cookieNAME) { var cname = ' ' + cookieNAME + '='; var cookies = document.cookie; if (cookies.indexOf(cname) == -1) { return filterID; } cookies = cookies.substr(cookies.indexOf(cname), cookies.length); if (cookies.indexOf(';') != -1) { cookies = cookies.substr(0, cookies.indexOf(';')); } cookies = cookies.split('=')[1]; return decodeURI(cookies);}
  24. window.location.href = ("https://www.curseforge.com/" + game + "/" + type + "/" + mod + "/files/all?filter-game-version=" + cookieREAD('curseFilter'));
  25. };
  26.  
  27. setTimeout(function() {
  28. filterID = urlALL.split('=')[1];
  29. var data = new Date(9999,1,2);
  30. var finalDATA = data.toGMTString();
  31. document.cookie = 'curseFilter='+ filterID + '; expires=' + finalDATA + '; path=/';
  32. }, (1 * 3000));
  33.  
  34. })();