Steam Auto Queue

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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