-
Notifications
You must be signed in to change notification settings - Fork 27
/
Steam-AutoCraft.user.js
56 lines (47 loc) · 1.53 KB
/
Steam-AutoCraft.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// ==UserScript==
// @name Steam-AutoCraft
// @namespace http://10101000.redirectme.net/
// @version 1.1
// @description AutoCraft Badges inside Steam
// @author 10101000 aka Ryan Steed
// @match *://steamcommunity.com/*/gamecards/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @copyright 2015 10101000 (Ryan Steed)
// @grant none
// ==/UserScript==
// Isolate jQuery for compatibility with other scripts
jQuery.noConflict();
var craftBadgeState = 0;
var invLinks = jQuery('.gamecards_inventorylink');
jQuery(document).ready(function(){
if (jQuery('.badge_card_to_collect').length === 0){
checkBadge();
}
if (craftBadgeState == 1){
addButton();
}
if (window.sessionStorage.autoCraftState){
autoCraft();
}
});
function addButton(){
if (invLinks){
invLinks.append('<a><button type="button" class="btn_grey_grey btn_small_thin" id="autocraft"><span>AutoCraft remaining badges</span></button></a>');
jQuery('#autocraft').click(function(){ autoCraft(); });
}
}
function checkBadge(){
if (jQuery('.badge_craft_button').length >= 1){
craftBadgeState = 1;
} else {
delete window.sessionStorage.autoCraftState;
}
}
function craftBadge(){
jQuery('.badge_craft_button').click();
}
function autoCraft(){
craftBadge();
setTimeout(function(){ checkBadge(); window.location.reload(true); }, 10000);
window.sessionStorage.autoCraftState = 1;
}