Check all steam store game links if it's owned
目前為
// ==UserScript==
// @name Steam Store - Game Owned Checker
// @icon http://store.steampowered.com/favicon.ico
// @namespace Royalgamer06
// @version 1.2.1
// @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.isIncognito) {
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;'>✔ </span>" + $(this).html() : $(this).html() + "<span style='color: green;'> ✔</span>"); //✔
} else { //else not owned
if ($.inArray(appID, wishlist) > -1) { //if wishlisted
$(this).html(prefix ? "<span style='color: HotPink;'>❤ </span>" + $(this).html() : $(this).html() + "<span style='color: HotPink;'> ❤</span>"); //❤
} else { //else not wishlisted
$(this).html(prefix ? "<span style='color: red;'>✖ </span>" + $(this).html() : $(this).html() + "<span style='color: red;'> ✖</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;'>✔ </span>" + $(this).html() : $(this).html() + "<span style='color: green;'> ✔</span>"); //✔
} else { //else not owned
$(this).html(prefix ? "<span style='color: red;'>✖ </span>" + $(this).html() : $(this).html() + "<span style='color: red;'> ✖</span>"); //✖
}
});
}
}
});