-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12963ee
commit b2e829b
Showing
4 changed files
with
186 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# Steam-Queue-Auto-Discover | ||
Automatic queue discoverer for Steam Sales | ||
# Steam Queue Auto Discover | ||
This small script saves you some minutes every day if you are collecting Steam Sale cards. | ||
|
||
![Screenshot of the "Discovery queues" section](screenshots/queue.png) | ||
|
||
## How to? | ||
There are two ways to use this script: | ||
|
||
### Directly from browser console: | ||
1. Open [Steam Queue Explore Page](https://store.steampowered.com/explore/) | ||
2. Do `right click` on opened page and open web-inspector | ||
|
||
<img src="screenshots/inspector.png" width="150"> | ||
3. Open `Console` | ||
4. Insert [script](https://raw.githubusercontent.com/denissdubinin/Steam-Queue-Auto-Discover/master/queue.js) in console and press `Enter` | ||
|
||
|
||
### Using browser extension: | ||
*Using this way script will be triggered each time you will open [Steam Queue Explore](https://store.steampowered.com/explore) page.* | ||
1. Install browser extension: | ||
[Chrome](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo), | ||
[Firefox](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/), | ||
[Opera](https://addons.opera.com/en/extensions/details/tampermonkey-beta/), | ||
[Safari](https://tampermonkey.net/?browser=safari) | ||
2. Open [Script page](https://raw.githubusercontent.com/denissdubinin/Steam-Queue-Auto-Discover/master/queue.user.js) | ||
4. Click `Install` | ||
3. Open [Steam Queue Explore Page](https://store.steampowered.com/explore) | ||
|
||
## Is there any risks? | ||
No, this script emulates web requests, Steam will see these requests as real queue visits. | ||
|
||
## Note | ||
Please note, that you can get only 3 cards per day and only during Steam Sale. | ||
|
||
## Issue reporting | ||
Faced with any issue? [Report the issue](https://github.com/denissdubinin/Steam-Queue-Auto-Discover/issues) or [fix it by yourself](https://github.com/denissdubinin/Steam-Queue-Auto-Discover/pulls). You are welcome 😊 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
// ==UserScript== | ||
// @author Deniss Dubinin | ||
// @name Steam Queue Auto Discover | ||
// @description Automatic queue discoverer for 3 Steam Sale cards getting | ||
// @version 1.0.0 | ||
// @namespace https://raw.githubusercontent.com/denissdubinin/Steam-Queue-Auto-Discover | ||
// @updateURL https://raw.githubusercontent.com/denissdubinin/Steam-Queue-Auto-Discover/master/queue.user.js | ||
// @supportURL https://github.com/denissdubinin/Steam-Queue-Auto-Discover/issues | ||
// @icon https://store.steampowered.com/favicon.ico | ||
// @match https://store.steampowered.com/explore | ||
// ==/UserScript== | ||
|
||
(function(window) { | ||
'use strict'; | ||
|
||
const SESSION_ID = g_sessionID; | ||
const GENERATE_QUEUE_URL = 'https://store.steampowered.com/explore/generatenewdiscoveryqueue'; | ||
const QUEUE_ITEM_URL = 'https://store.steampowered.com/app/'; | ||
const NEXT_QUEUE_URL = 'https://store.steampowered.com/explore/next/0/'; | ||
|
||
let queueItems = [], | ||
mainQueueIterator = 0, | ||
error = false, | ||
popup; | ||
|
||
class sendRequest { | ||
send(url, params, successCallback) { | ||
var urlParams; | ||
|
||
urlParams = Object.keys(params).map( | ||
function(param) { | ||
return encodeURIComponent(param) + '=' + encodeURIComponent(params[param]) | ||
} | ||
).join('&'); | ||
|
||
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); | ||
|
||
xhr.open('POST', url); | ||
|
||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState === 4) { | ||
switch (xhr.status) { | ||
case 200: | ||
error = false; | ||
|
||
if (successCallback !== undefined && | ||
successCallback !== null | ||
) { | ||
successCallback(xhr.response); | ||
} | ||
break; | ||
default: | ||
error = true; | ||
generateNewQueue(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); | ||
xhr.send(urlParams); | ||
|
||
return xhr; | ||
} | ||
} | ||
|
||
let sendRequestClass = new sendRequest(); | ||
|
||
function generateNewQueue() { | ||
if (popup !== undefined) { | ||
popup.Dismiss(); | ||
} | ||
|
||
if (mainQueueIterator < 3) { | ||
let popupContext = ''; | ||
|
||
if (error) { | ||
popupContext = `Error happened. Discovering queue #${mainQueueIterator + 1}`; | ||
} else { | ||
popupContext = `Discovering queue #${mainQueueIterator + 1}`; | ||
} | ||
|
||
popup = ShowBlockingWaitDialog( | ||
'Queue autodiscover', | ||
popupContext | ||
); | ||
|
||
sendRequestClass.send( | ||
GENERATE_QUEUE_URL, { | ||
sessionid: SESSION_ID, | ||
queuetype: 0, | ||
snr: '1_5_9__discovery-queue-0' | ||
}, | ||
generateQueueCallback | ||
); | ||
|
||
mainQueueIterator++; | ||
} else { | ||
let button = '<a class="btn_green_white_innerfade btn_medium"' + | ||
'href="#" onClick="window.location = \'https://store.steampowered.com/\'">' + | ||
'<span>Reload The Page</span></a>' + | ||
'<style>.waiting_dialog_throbber {display: none;}</style>', | ||
popup = ShowBlockingWaitDialog( | ||
'Queue autodiscover', | ||
'Autodiscover finished. ' + button | ||
); | ||
} | ||
} | ||
|
||
function generateQueueCallback(response) { | ||
if (response === undefined || | ||
JSON.parse(response).queue === undefined | ||
) { | ||
return; | ||
} | ||
|
||
var i, | ||
length, | ||
callback = null, | ||
queueItems = JSON.parse(response).queue; | ||
|
||
for (i = 0, length = queueItems.length; i < length; ++i) { | ||
if (queueItems[i] === queueItems[length - 1]) { | ||
callback = function() { | ||
sendRequestClass.send( | ||
NEXT_QUEUE_URL, { | ||
appid_to_clear_from_queue: queueItems[i], | ||
sessionid: SESSION_ID, | ||
snr: '1_5_9__discovery-queue-0' | ||
}, | ||
generateNewQueue | ||
); | ||
} | ||
} | ||
|
||
sendRequestClass.send( | ||
QUEUE_ITEM_URL + queueItems[i], { | ||
appid_to_clear_from_queue: queueItems[i], | ||
sessionid: SESSION_ID, | ||
}, | ||
callback | ||
); | ||
|
||
callback = null; | ||
}; | ||
} | ||
|
||
generateNewQueue(); | ||
})(window); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.