Steam Auto Queue

自动探索Steam队列,有延时,可暂停

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Steam Auto Queue
// @namespace   [email protected]
// @description 自动探索Steam队列,有延时,可暂停
// @include     /^https?:\/\/store\.steampowered\.com\/((?:agecheck\/)?app\/\d+|explore)/
// @version     1
// @grant       none
// jshint esversion:6
// ==/UserScript==

// Settings
var AUTO_DISCOVERY_QUEUE = true;
var AUTO_DISCOVERY_QUEUE_DELAY = 0;
var AUTO_DISCOVERY_QUEUE_STOPPED_TITLE_PREFIX = "【已停止梦游】";
var AUTO_DISCOVERY_QUEUE_WITHOUT_CARD_DROP = false;
// Settings End


// Auto discovery queue
if(AUTO_DISCOVERY_QUEUE){
	let timeoutId = setTimeout(AutoQueue, AUTO_DISCOVERY_QUEUE_DELAY);
	
	document.addEventListener(
		"keydown",
		(e) => {
			e.preventDefault();
			e.stopPropagation();
			document.title = AUTO_DISCOVERY_QUEUE_STOPPED_TITLE_PREFIX + document.title;
			setTimeout(
				()=>{
					document.title = document.title.replace(AUTO_DISCOVERY_QUEUE_STOPPED_TITLE_PREFIX,"")
				},
				1000
			);
			clearTimeout(timeoutId);
			console.log("Auto Queue Stopped");
		},
		{capture:true, once:true}
	);
}

// Auto browse discovery queue
function AutoQueue(){
	var discoveryQueueWinterSaleCardsHeaderSubText = document.getElementsByClassName('subtext');
	var refreshQueueBtn = document.getElementById('refresh_queue_btn');
	if (refreshQueueBtn != null 
		&& (AUTO_DISCOVERY_QUEUE_WITHOUT_CARD_DROP
			|| ( discoveryQueueWinterSaleCardsHeaderSubText.length > 0 
				&& /^.+\s\d\s.+$/.test(discoveryQueueWinterSaleCardsHeaderSubText[0].innerHTML)
				)
			)
	){
		setTimeout(()=>{refreshQueueBtn.click()}, 500);
	}
	var nextInQueueForm = document.getElementById('next_in_queue_form');
	if (nextInQueueForm !== null){
		nextInQueueForm.submit();
		console.log("SteamTemp: nextInQueueForm submit");
	}

	var ageYear = document.getElementById('ageYear');
	if (ageYear !== null) {
		ageYear.selectedIndex = 77;
		DoAgeGateSubmit();
		console.log("SteamTemp: ageYear submit");
	}else{
		console.log("SteamTemp: ageYear not found");
	}
	
	var appId = location.href.match(/app\/(\d+)/)[1];
	if(document.title === "Site Error"){
		$J.post("/app/7", { sessionid: g_sessionID, appid_to_clear_from_queue: appId });
		console.warn("Locked game: " + appId + " removed.");
		window.location = "http://store.steampowered.com"
	}
}