Steam Auto Queue

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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"
	}
}