// ==UserScript== // @name steam创意工坊(合集)一键下载 // @namespace http://tampermonkey.net/ // @version 0.1 // @description steam创意工坊一键下载,仅支持合集,需配合steamcmd下载 // @author menkeng // @match https://steamcommunity.com/sharedfiles/filedetails/* // @icon https://www.google.com/s2/favicons?sz=64&domain=steamcommunity.com // @grant unsafeWindow // @require https://unpkg.com/jquery@3.6.0/dist/jquery.min.js // @downloadURL none // ==/UserScript== /* globals jQuery, $, waitForKeyElements */ // This is how site search get access to the shadow root // var shadowRoot = $(element.shadowRoot); // 定制服务 Q:605011383 // 定制服务 Q:605011383 // 定制服务 Q:605011383 function download(filename, text) { var pom = document.createElement('a'); pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); pom.setAttribute('download', filename); if (document.createEvent) { var event = document.createEvent('MouseEvents'); event.initEvent('click', true, true); pom.dispatchEvent(event); } else { pom.click(); } } var dl = document.createElement("div") var text = "login anonymous\n" var reg = /https:\/\/steamcommunity.com\/sharedfiles\/filedetails\/\?id=/g var bee = "workshop_download_item " var game_id = $("div.apphub_OtherSiteInfo.responsive_hidden > a").attr("data-appid") var dl_css = "class: button; width: 30px;height: 20px;position: fixed;top: 100px;right: 50px;background:#95afcb;color:black;" $(".collectionItemDetails > a").each(function (index, element) { var str = $(this).attr("href") var mod_id = str.replace(reg,""); text = text + bee + game_id + " " + mod_id + "\n" }); $(function(){ dl.style.cssText = dl_css dl.className = "collectionItemAuthor" dl.onclick =function(){download("steamcmd.txt",text)} dl.innerText="下载" $("body").append(dl) });