Steam, Badge Creator Automate

This script automatically craft badge if you have enough cards

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Steam, Badge Creator Automate
// @namespace    http://tampermonkey.net/
// @version      0.21
// @description  This script automatically craft badge if you have enough cards
// @author       You
// @match        https://steamcommunity.com/id/*/badges/*
// @match        https://steamcommunity.com/id/*/gamecards/*/
// @grant        none
// @runat        document-end
// @nowrap
// ==/UserScript==

(function() {
    'use strict';
    var blacklist = [1343890];
    var craftTimeout = 1500;
    var searchTimeout = 1500;

    jQuery(function () {
        setTimeout(function () {
            var $craft = jQuery(".badge_craft_button").filter(function (index, element) {
                for (var i = 0; i < blacklist.length; i++) {
                    if ((element.href || element.onclick || "").toString().indexOf(blacklist[i]) >= 0) return false;
                }
                return true;
            });

            if ($craft.length > 0) {
                var button = Array.prototype.pop.call($craft).click();

                if (location.pathname.indexOf("/gamecards/") >= 0) {
                    setTimeout(function () {
                        jQuery(".profile_small_header_location").first().click();
                    }, craftTimeout);
                }
            }

        }, searchTimeout);
    });
})();