Greasy Fork

来自缓存

Greasy Fork is available in English.

steam创意工坊(合集)一键下载

steam创意工坊一键下载,仅支持合集,需配合steamcmd下载

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         steam创意工坊(合集)一键下载
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  steam创意工坊一键下载,仅支持合集,需配合steamcmd下载
// @author       menkeng
// @match        https://steamcommunity.com/sharedfiles/filedetails/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=steamcommunity.com
// @require      https://unpkg.com/[email protected]/dist/jquery.min.js
// ==/UserScript==
/* globals jQuery, $,*/
//脚本定制Q:605011383
//脚本定制Q:605011383
//脚本定制Q:605011383

const getGameId = () => $('div.apphub_OtherSiteInfo.responsive_hidden > a').data('appid');
const getModIds = () => $('.collectionItemDetails > a').map((_, element) => $(element).attr('href').replace(/https:\/\/steamcommunity.com\/sharedfiles\/filedetails\/\?id=/g, '')).get();
const generateDownloadText = (gameId, modIds) => {
  const modIdStr = modIds.map(modId => `+workshop_download_item ${gameId} ${modId}`).join(' ');
  return `@echo off\nsteamcmd +login anonymous ${modIdStr}`;
};
const downloadMods = (gameId, modIds) => {
  const text = generateDownloadText(gameId, modIds);
  const filename = $('div.workshopItemTitle')[0].textContent + '.bat';
  $('<a>', {
    href: 'data:text/plain;charset=utf-8,' + encodeURIComponent(text),
    download: filename,
    style: 'display:none'
  }).appendTo('body')[0].click()
};
const createDownloadButton = () => {
  const dl = document.createElement('div');
  dl.style.cssText = 'position: fixed; top: 120px; right: 50px; width: 80px; height: 30px; font-size: 16px; font-weight: bold; text-align: center; line-height: 30px; background-color: #4CAF50; color: white; border-radius: 5px; cursor: pointer; box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);';
  dl.innerText = '下载';
  dl.onclick = () => {
    const gameId = getGameId();
    const modIds = getModIds();
    downloadMods(gameId, modIds);
  };
  return dl;
};
$(() => $('body').append(createDownloadButton()));