├── README.md └── SteamDiscoveryQueueBot.user.js /README.md: -------------------------------------------------------------------------------- 1 | # Steam Discovery Queue Card Auto Harvester 2 | This is a Userscript to automatically harvest the discovery queue Trading Cards, can be run with either [Tampermonkey](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/) (Firefox) or [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en) (Chrome/Opera); 3 | 4 | To use the script just download by clicking [THIS](https://raw.githubusercontent.com/AceLewis/SteamDiscoveryQueueBot/master/SteamDiscoveryQueueBot.user.js) or just copy and paste the text into the Userscript editor. Stop the script when you have got all the cards for that day. 5 | 6 | This script should work for all languages and will automatically got through the discovery queue. 7 | 8 | To run the script go to the [steam storepage](http://store.steampowered.com/) and click the "Get cards" button in the top left hand corner. 9 | 10 | Licence: MIT 11 | -------------------------------------------------------------------------------- /SteamDiscoveryQueueBot.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name SteamDiscoveryQueueBot 3 | // @namespace https://AceLewis.com 4 | // @description Automatically harvest daily free steam trading cards 5 | // @include http*://store.steampowered.com/* 6 | // @grant GM_addStyle 7 | // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js 8 | // ==/UserScript== 9 | 10 | //this.$ = this.jQuery = jQuery.noConflict(true); 11 | 12 | // Create button 13 | var zNode = document.createElement ('div'); 14 | zNode.innerHTML = ''; 15 | zNode.setAttribute ('id', 'myContainer'); 16 | document.body.appendChild(zNode); 17 | 18 | // Allow button to be clicked 19 | document.getElementById ("myButton").addEventListener ( 20 | "click", ButtonClickAction, false 21 | ); 22 | 23 | function ButtonClickAction(zEvent) { 24 | window.location.replace('http://store.steampowered.com/explore'); 25 | OpenQueue(); 26 | } 27 | 28 | console.log(window.location.href); 29 | 30 | if (window.location.href.indexOf('agecheck') > -1){ 31 | console.log('Age check'); 32 | ByPassAgeCheck(); 33 | } 34 | else if (window.location.href.indexOf('/app/') > -1){ 35 | console.log('Click next'); 36 | ClickNext(); 37 | } 38 | else if (window.location.href.indexOf('/explore') > -1){ 39 | console.log('OK'); 40 | OpenQueue(); 41 | } 42 | 43 | function OpenQueue(){ 44 | // Click the button to go to start the queue 45 | //jQuery('#refresh_queue_btn').click(); 46 | document.querySelector('#refresh_queue_btn').click(); 47 | //jQuery('.discovery_queue_start_link').click(); 48 | document.querySelector('.discovery_queue_start_link').click(); 49 | } 50 | 51 | function ByPassAgeCheck(){ 52 | // A cleaned up version of http://userscripts-mirror.org/scripts/review/97849 53 | 54 | // Get form 55 | try { 56 | var AgeForm = document.getElementById('agegate_box').getElementsByTagName('form')[0]; 57 | 58 | // Get selection list 59 | var SelectionList = AgeForm.getElementsByTagName('select'); 60 | 61 | // Loop through selection list 62 | for (var Index = 0; SelectionList.length !== Index; ++Index) { 63 | // Get selection 64 | var Selection = SelectionList[Index]; 65 | 66 | // Check name 67 | if ('ageYear' === Selection.name) 68 | { 69 | // Set year 70 | Selection.value = '1970'; 71 | } 72 | } 73 | 74 | // Submit form 75 | AgeForm.submit(); 76 | } 77 | catch(err) { 78 | // Other form of age check 79 | var NewAgeForm = document.getElementById('next_in_queue_form'); 80 | NewAgeForm.submit(); 81 | } 82 | } 83 | 84 | 85 | function ClickNext(){ 86 | console.log('Will click button'); 87 | //jQuery('.next_in_queue_content').click(); 88 | document.querySelector('.next_in_queue_content').click(); 89 | 90 | } 91 | 92 | // CSS for button 93 | GM_addStyle ( multilineStr (function (){/*! 94 | #myContainer { 95 | position: absolute; 96 | top: 0; 97 | left: 0; 98 | font-size: 15px; 99 | background: #171a21; 100 | border: 3px outset black; 101 | margin: 5px; 102 | opacity: 0.8; 103 | z-index: 222; 104 | padding: 2px 5px; 105 | } 106 | #myButton { 107 | cursor: pointer; 108 | } 109 | #myContainer p { 110 | color: red; 111 | background: white; 112 | } 113 | */} ) ); 114 | 115 | function multilineStr (dummyFunc) { 116 | var str = dummyFunc.toString (); 117 | str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*! 118 | .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ } 119 | .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them. 120 | ; 121 | return str; 122 | } 123 | --------------------------------------------------------------------------------