Adds steam links to Humble Bundle games (https://greatest.deepsurf.us/en/scripts/26273-steam-store-game-owned-checker COMPATIBLE!)
当前为
// ==UserScript==
// @name Humble Bundle - Steam Links Adder
// @icon https://humblebundle-a.akamaihd.net/static/hashed/47e474eed38083df699b7dfd8d29d575e3398f1e.ico
// @namespace Royalgamer06
// @version 1.0
// @description Adds steam links to Humble Bundle games (https://greatest.deepsurf.us/en/scripts/26273-steam-store-game-owned-checker COMPATIBLE!)
// @author Royalgamer06
// @include /^https?\:\/\/www\.humblebundle\.com\/.*$/
// @grant GM_xmlhttpRequest
// @run-at document-start
// @connect api.steampowered.com
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.js
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var applist = [];
GM_xmlhttpRequest({
method: "GET",
url: "https://api.steampowered.com/ISteamApps/GetAppList/v2/",
onload: function(response) {
applist = JSON.parse(response.responseText).applist.apps;
$(".desktop:has(.hb-steam) .dd-image-box-caption, .entity-title, .product-title > h2, em, .humble-original-title").each(function() {
steamify($(this));
});
}
});
function steamify(titleElem) {
var title = $(titleElem).text().toLowerCase().replace(/\(early access\)|\(pre\-order\)|\:|\-|\–|\\|\/|\™|\®| |\'|\.|\?|\!/g, "").trim();
var obj = applist.filter(function(v) { return v.name.toLowerCase().replace(/\:|\-|\–|\\|\/|\™|\®| |\'|\.|\?|\!/g, "").trim() == title; })[0];
if (obj !== undefined) {
var appID = obj.appid;
$(titleElem).replaceWith("<a href='http://store.steampowered.com/app/" + appID + "/'>" + titleElem[0].outerHTML + "</a>");
}
}