Steam Store - Game Owned Checker

Check all steam store game links if it's owned

Version au 08/04/2017. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==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>"); //✖
                }
            });
        }
    }
});