// ==UserScript== // @name CurseForge Downloader // @namespace https://www.yesterday17.cn/ // @version 1.0.2 // @description Download files from curseforge directly instead of launching Twitch. // @author Yesterday17 // @include *://www.curseforge.com/* // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/386966/CurseForge%20Downloader.user.js // @updateURL https://update.greasyfork.icu/scripts/386966/CurseForge%20Downloader.meta.js // ==/UserScript== "use strict"; (function() { const elements = document.querySelectorAll(`a[href$="client=y"]`); Array.from(elements).forEach(aNode => { // remove client=y let link = aNode.getAttribute("href").replace(/\?client=y/g, ""); // modpack main mage if (/(?:\/[^\/])*?\/download\/\d+/.test(link)) { link += "/file"; } aNode.setAttribute("href", link); // change icon let child = aNode.firstElementChild; if (child.tagName !== "svg") { child = child.firstElementChild; } child.setAttribute("viewBox", "0 0 20 20"); child.innerHTML = ''; // Change text from 'Install' to 'Download' aNode.innerHTML = aNode.innerHTML.replace("Install", "Download"); }); })();