Steam Store - Free Packages Button

This userscript adds a button to the steam licenses page that adds free packages.

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

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

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 Store - Free Packages Button
// @namespace    Royalgamer06
// @version      1.2
// @description  This userscript adds a button to the steam licenses page that adds free packages.
// @author       Royalgamer06
// @include      /^https:\/\/store\.steampowered\.com\/account\/licenses\/?$/
// @connect      steamdb.info
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @run-at       document-idle
// ==/UserScript==

// ==Code==
jQuery(".breadcrumbs").append("<a id='btnFreePackages' class='btn_green_white_innerfade btn_medium' href='javascript:getFreePackages()' style='float:right;width:170px;'><span style='text-align:center;'>Get Free Packages</span></a>");
unsafeWindow.getFreePackages = function() {
    console.log("Getting free packages...");
    jQuery("#btnFreePackages").html("<center><img alt='ajaxloader' src='//steamcommunity-a.akamaihd.net/public/images/login/throbber.gif'></img></center>").prop("disabled", true);
    GM_xmlhttpRequest({
        method: "GET",
        url: "https://steamdb.info/freepackages/",
        timeout: 30000,
        onload: function(response) {
            var script = jQuery("#freepackages", response.responseText).text();
            console.log(script);
            jQuery("#btnFreePackages").remove();
            console.log("Adding free packages...");
            jQuery.globalEval(script);
        },
        onerror: console.log,
        ontimeout: console.log
    });
};
// ==/Code==