Subscribes to all workshop items from a particular AppID
当前为
// ==UserScript==
// @name Steam Community - All Workshop Items Subscriber
// @namespace Royalgamer06
// @version 0.1
// @description Subscribes to all workshop items from a particular AppID
// @author Royalgamer06
// @include *://steamcommunity.com/workshop/browse/?appid=*
// @grant none
// ==/UserScript==
function subAll(method) {
var appid = location.href.split("appid=")[1].split("&")[0];
var sessionid = g_sessionID;
var pages = document.querySelectorAll(".pagelink");
var lastpage = 0;
for (var i = 0; i < pages.length; i++) {
var page = parseInt(pages[i].innerHTML);
if (page > lastpage) { lastpage = page; }
}
for (var i = 1; i <= lastpage; i++) {
var url = location.href;
url = url.split("p=")[0] + "p=" + i + url.split("p=")[1].replace(url.split("p=")[1].split("&")[0], "");
jQuery.get(url, function(data) {
var s = jQuery(data).find(".workshopItemPreviewHolder");
for (var i = 0; i < s.length; i++) {
var wsid = s[i].getAttribute("id").replace("sharedfile_","");
jQuery.post("http://steamcommunity.com/sharedfiles/" + method, { id: wsid, appid: appid, sessionid: sessionid });
}
});
}
}
jQuery(document).ready(function() {
var html = '<div class="rightSectionTopTitle">Subscriptions:</div> <div class="rightDetailsBlock"> <div style="position:relative;"> <img class="browseOptionImage" src="http://steamcommunity-a.akamaihd.net/public/images/sharedfiles/filterselect_blue.png?v=1"> <div class="browseOption mostrecent"><a id="suball">Subscribe All</a></div> </div> <div style="position:relative;"> <img class="browseOptionImage" src="http://steamcommunity-a.akamaihd.net/public/images/sharedfiles/filterselect_blue.png?v=1"> <div class="browseOption mostrecent"><a id="unsuball">Unsubscribe All</a></div> </div><hr> </div> </div>';
jQuery(".panel:first").prepend(html);
document.getElementById("suball").onclick = function() { subAll("subscribe"); };
document.getElementById("unsuball").onclick = function() { subAll("unsubscribe"); };
});