Dota 2 Workshop Guide Auto Subscribe

Subscribe all guides on Dota 2 workshop page in 1 click

目前為 2018-09-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name            Dota 2 Workshop Guide Auto Subscribe
// @author          popiazaza
// @namespace       popiazaza
// @description     Subscribe all guides on Dota 2 workshop page in 1 click
// @version         1.0
// @include         https://steamcommunity.com/id/*/myworkshopfiles/?section=guides*
// @grant           none
// ==/UserScript==
function dota2workshopsubnow(){
	var guideList = [];
	var subscribedList = [];
	
	jQuery("script").each(function(){
		var guidematch = jQuery(this).html().match(/SharedFileBindMouseHover\( "(.*?)", true, (.*?) \);/);
		if(guidematch){
			var guidedetail = JSON.parse(guidematch[2].replace(/(\r\n|\n|\r)/gm,""));
			guideList.push(guidedetail.id);
			subscribedList[guidedetail.id] = guidedetail.user_subscribed;
		}
	});
	
	var i = 0,
	    loaded = 0,
	    package = 0,
	    total = guideList.length,
	    modal = ShowBlockingWaitDialog( 'Executing…',
	    	'Please wait until all requests finish. Ignore all the errors, let it finish.' );
	
	for( ; i < total; i++ )
	{
		guideid = guideList[ i ];
		
		if( subscribedList[ guideid ] )
		{
			loaded++;
			continue;
		}
		
		jQuery.post(
			'//steamcommunity.com/sharedfiles/subscribe',
			{
				appid: 570,
				id: guideid,
				sessionid: g_sessionID
			}
		).always( function( )
			{
				loaded++;
				
				modal.Dismiss();
				
				if( loaded >= total )
				{
					location.reload();
				}
				else
				{
					modal = ShowBlockingWaitDialog( 'Executing…',
						'Loaded <b>' + loaded + '</b>/' + total + '.' );
				}
			}
		);
	}
}

(function()
{
  jQuery('.followStatsBlock').append('<a href="javascript:void(0);" id="dota2workshopsuball" class="btn_darkblue_white_innerfade btn_medium"><span>Subscribe all on this page</span></a>');
  document.getElementById('dota2workshopsuball').addEventListener('click', dota2workshopsubnow, false);
}());

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址