Greasy Fork

来自缓存

Greasy Fork is available in English.

CurseForge Downloader

Download files from curseforge directly instead of launching Twitch.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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
// ==/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 =
      '<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9989 7.97269H14.0369C14.4409 7.97269 14.8069 8.21669 14.9609 8.58969C15.1159 8.9637 15.0299 9.39369 14.7439 9.67969L10.7189 13.7257C10.5309 13.9127 10.2769 14.0187 10.0119 14.0187C9.7459 14.0187 9.4919 13.9127 9.3049 13.7257L5.2789 9.67969C4.9929 9.39369 4.9079 8.9637 5.0629 8.58969C5.2169 8.21669 5.5819 7.97269 5.9859 7.97269H8.0049V2.99969C8.0049 2.44769 8.4519 1.99969 9.0049 1.99969H10.9989C11.5509 1.99969 11.9989 2.44769 11.9989 2.99969V7.97269ZM4 18H16C16.553 18 17 17.553 17 17C17 16.447 16.553 16 16 16H4C3.448 16 3 16.447 3 17C3 17.553 3.448 18 4 18Z"/>';

    // Change text from 'Install' to 'Download'
    aNode.innerHTML = aNode.innerHTML.replace("Install", "Download");
  });
})();