Steam Store - Game Owned Checker

Check all steam store game links if it's owned

2017-04-08 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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