您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Download files from curseforge directly instead of launching Twitch.
当前为
- // ==UserScript==
- // @name CurseForge Downloader
- // @namespace https://www.yesterday17.cn/
- // @version 1.0.0
- // @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(
- '.icon.icon-margin use[*|href="/Content/2-0-7117-35996/Skins/CurseForge/images/twitch/Logo/Glitch.svg#Logo/Glitch"]'
- );
- Array.from(elements)
- .map(item => {
- let button = item;
- while (item.nodeName !== "A") {
- item = item.parentElement;
- }
- return item;
- })
- .forEach((download, index) => {
- // change link
- let link = download.getAttribute("href").replace(/\?client=y/g, "");
- if (/(?:\/[^\/])*?\/download\/\d+/.test(link)) {
- link += "/file";
- }
- download.setAttribute("href", link);
- // change icon
- elements[index].parentElement.setAttribute("viewBox", "0 0 20 20");
- elements[index].setAttribute(
- "xlink:href",
- "/Content/2-0-7117-35996/Skins/CurseForge/images/twitch/Action/Download.svg#Action/Download"
- );
- });
- })();