Skip to content

Instantly share code, notes, and snippets.

@xPaw
Last active June 21, 2024 16:13
Show Gist options
  • Save xPaw/73f8ae2031b4e528abf7 to your computer and use it in GitHub Desktop.
Save xPaw/73f8ae2031b4e528abf7 to your computer and use it in GitHub Desktop.
⚠ This script has been integrated into SteamDB browser extension!
// ==UserScript==
// @name Steam Queue Auto Discoverer
// @description Discover the Steam queue three times to get the sale cards
// @version 2.3.0
// @namespace https://gist.github.com/xPaw/73f8ae2031b4e528abf7
// @icon https://store.steampowered.com/favicon.ico
// @match https://store.steampowered.com/explore*
// @grant none
// ==/UserScript==
var DiscoveryQueueModal, GenerateQueue = function( queueNumber )
{
if( DiscoveryQueueModal )
{
DiscoveryQueueModal.Dismiss();
}
DiscoveryQueueModal = ShowBlockingWaitDialog( 'Generating the queue...', 'Generating new discovery queue #' + ++queueNumber );
jQuery.post( 'https://store.steampowered.com/explore/generatenewdiscoveryqueue', { sessionid: g_sessionID, queuetype: 0 } ).done( function( data )
{
var requests = [], done = 0, errorShown;
for( var i = 0; i < data.queue.length; i++ )
{
var request = jQuery.post( 'https://store.steampowered.com/app/10', { appid_to_clear_from_queue: data.queue[ i ], sessionid: g_sessionID } );
request.done( function()
{
if( errorShown )
{
return;
}
DiscoveryQueueModal.Dismiss();
DiscoveryQueueModal = ShowBlockingWaitDialog( 'Exploring the queue...', 'Request ' + ++done + ' of ' + data.queue.length );
} );
request.fail( function()
{
if( errorShown )
{
return;
}
errorShown = true;
DiscoveryQueueModal.Dismiss();
DiscoveryQueueModal = ShowBlockingWaitDialog( 'Error', 'Failed to clear queue item #' + ++done + '. Will try again soon.' );
} );
requests.push( request );
}
var callback = function()
{
DiscoveryQueueModal.Dismiss();
if( queueNumber < 3 )
{
GenerateQueue( queueNumber );
}
else
{
DiscoveryQueueModal = ShowConfirmDialog( 'Done', 'Queue has been explored ' + queueNumber + ' times', 'Reload the page' ).done( function() {
ShowBlockingWaitDialog( 'Reloading the page' );
window.location.reload();
});
}
};
jQuery.when.apply( jQuery, requests ).then( callback, callback );
} ).fail( function()
{
setTimeout( () => GenerateQueue( queueNumber - 1 ), 1000 );
DiscoveryQueueModal.Dismiss();
DiscoveryQueueModal = ShowBlockingWaitDialog( 'Error', 'Failed to generate new queue #' + queueNumber + '. Trying again in a second.' );
} );
};
var buttonContainer = document.createElement( 'div' );
buttonContainer.className = 'discovery_queue_customize_ctn';
buttonContainer.innerHTML = '<div class="btnv6_blue_hoverfade btn_medium" id="js-cheat-queue"><span>Cheat the queue</span></div><span>Discover the queue three times to get the sale cards</span>';
var container = document.querySelector( '.discovery_queue_customize_ctn' );
container.parentNode.insertBefore( buttonContainer, container );
var button = document.getElementById( 'js-cheat-queue' );
button.addEventListener( 'click', function( )
{
GenerateQueue( 0 );
container.parentNode.removeChild( buttonContainer );
}, false );
@Exodus5467
Copy link

@AlejandroC90 Mirá donde te vengo a encontrar linceso
Neat Script!

@AlejandroC90
Copy link

@Exodus5467 jaja, estamos por todo lado

@amberhwang
Copy link

thanks mate!

@Hlidskialf7
Copy link

Awesome

@quahansudung
Copy link

It's working

@hxgdzyuyi
Copy link

cool 👍

@alpasy
Copy link

alpasy commented Jun 26, 2016

VM1026:5 Uncaught ReferenceError: ShowBlockingWaitDialog is not defined(…)
in Chrome for me :-\

upd. my bad, should've run the script on top of all the browser extensions. working fine now, thanks!

@Kovah
Copy link

Kovah commented Jun 26, 2016

Thanks @alpasy for the tip! 👍

@aveao
Copy link

aveao commented Jun 26, 2016

Nice edit @xPaw!

@nunocunha
Copy link

nunocunha commented Jun 28, 2016

I've created a UserScript wrapper for this script. It automagically updates whenever @xPaw updates this gist.

@Pilaba
Copy link

Pilaba commented Jun 30, 2016

you are awesome m8

@alpasy
Copy link

alpasy commented Dec 23, 2016

doesn't work this time?

Uncaught TypeError: Cannot read property 'parentNode' of null
at :76:10

@longlyduc
Copy link

still work like a charm, thankyou :)

@mig0sd
Copy link

mig0sd commented Jun 23, 2017

Is there a way to install into tampermonkey without manually inserting (pasting) the JS into TM? Usually going to the raw link works.

@aveao
Copy link

aveao commented Jun 24, 2017

@mig0sd (and @xPaw) it'd automatically install if the extension was .user.js and not .js

@user
Copy link

user commented Dec 21, 2017

Thanks! 👍

@Enissay
Copy link

Enissay commented Dec 21, 2017

Seems not to work in FF. Clicking on the button does nothing.
It works fine in chrome though :-/

@chucky515
Copy link

nice.... thx!!!

@MatyiFKBT
Copy link

thanks a lot! works perfectly

@errorproxy
Copy link

How do I make this run on a page automatically?

@testman42
Copy link

Doesn't seem to be working any more.

@fuomag9
Copy link

fuomag9 commented Jun 21, 2018

For me it doesn't work, even tried with a clean browser (Chrome and Firefox)

@BrunoKrugel
Copy link

still working for me

@wankio
Copy link

wankio commented Jun 22, 2018

not working :((((((((((((((( tampermonkey/greasemonkey

@wankio
Copy link

wankio commented Jun 22, 2018

@paolareyes
Copy link

Still working for me, gg

@hill123455
Copy link

Ya still working, <3

@defaltadmin
Copy link

Great code! Is it possible to include a line at the top that shows instructions? I'm not familiar with coding so it took me a while to piece together the information from comments from here and reddit. Just 3 lines of instructions such as

  1. Be on the Explore page in browser
  2. Press Ctrl + Shift + J
  3. Paste this code and hit enter
  4. The button "Start queue" will change to "Cheat queue". Click it.

That's all.

@RudeySH
Copy link

RudeySH commented Sep 28, 2019

Is there any way to disable this feature? Just like there are many options to disable other features, I'd like to see an option to disable this.

@leoffx
Copy link

leoffx commented Dec 25, 2019

The link to the Explore page is https://store.steampowered.com/explore/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment