Steam Store - Free Packages Button

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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==