Steam Store - Game Owned Checker

Check all steam store game links if it's owned

Versione datata 08/04/2017. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Steam Store - Game Owned Checker
// @icon         http://store.steampowered.com/favicon.ico
// @namespace    Royalgamer06
// @version      1.2
// @description  Check all steam store game links if it's owned
// @author       Royalgamer06
// @include      /^https?\:\/\/.+/
// @exclude      /^https?\:\/\/.+\.steampowered\.com.*$/
// @grant        GM_xmlhttpRequest
// @grant        GM_openInTab
// @grant        GM_info
// @run-at       document-idle
// @connect      store.steampowered.com
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// ==/UserScript==

const prefix = false; //prefix (true) instead of suffix (false) position icon ❤/✔/✖

GM_xmlhttpRequest({
    method: "GET",
    url: "http://store.steampowered.com/dynamicstore/userdata/",
    onload: function(response) {
        var json = JSON.parse(response.responseText);
        var ownedApps = json.rgOwnedApps;
        var ownedPackages = json.rgOwnedPackages;
        var wishlist = json.rgWishlist;
        if (ownedApps.length === 0 && ownedPackages.length === 0 && wishlist.length === 0 && !GM_info.isPrivate) {
            if (confirm("Userscript '" + GM_info.script.name + "' did not work properly: Could not get user data.\nPlease make sure you are logged in to the Steam Store and dynamic store userdata is loaded.\nLogin first, then keep refreshing the dynamic store userdata page untill the data is loaded.\nDo you want to attempt to fix this now?")) {
                GM_openInTab("http://store.steampowered.com/dynamicstore/userdata/", false);
                GM_openInTab("http://store.steampowered.com/login/", false);
            } else {
                alert("Please disable the userscript 'Steam Store - Game Owned Checker' to stop receiving these popup's.");
            }
        } else {
            $("a[href*='//store.steampowered.com/app/'], a[href*='//store.steampowered.com/agecheck/app/']").each(function() {
                var appID = parseInt(this.href.split("app/")[1].split("/")[0].split("?")[0].split("#")[0]);
                if ($.inArray(appID, ownedApps) > -1) { //if owned
                    $(this).html(prefix ? "<span style='color: green;'>&#10004; </span>" + $(this).html() : $(this).html() + "<span style='color: green;'> &#10004;</span>"); //✔
                } else { //else not owned
                    if ($.inArray(appID, wishlist) > -1) { //if wishlisted
                        $(this).html(prefix ? "<span style='color: HotPink;'>&#10084; </span>" + $(this).html() : $(this).html() + "<span style='color: HotPink;'> &#10084;</span>"); //❤
                    } else { //else not wishlisted
                        $(this).html(prefix ? "<span style='color: red;'>&#10006; </span>" + $(this).html() : $(this).html() + "<span style='color: red;'> &#10006;</span>"); //✖
                    }
                }
            });
            $("a[href*='//store.steampowered.com/sub/']").each(function() {
                var subID = parseInt(this.href.split("sub/")[1].split("/")[0].split("?")[0].split("#")[0]);
                if ($.inArray(subID, ownedPackages) > -1) { //if owned
                    $(this).html(prefix ? "<span style='color: green;'>&#10004; </span>" + $(this).html() : $(this).html() + "<span style='color: green;'> &#10004;</span>"); //✔
                } else { //else not owned
                    $(this).html(prefix ? "<span style='color: red;'>&#10006; </span>" + $(this).html() : $(this).html() + "<span style='color: red;'> &#10006;</span>"); //✖
                }
            });
        }
    }
});