Greasy Fork is available in English.

Steam Game Marker (Humble Bundle)

Adds steam links and wishlist/owned/unowned icons to Humble Bundle games. Please login Steam's official website in your broswer first. Based on https://greasyfork.org/scripts/27373-humble-bundle-steam-links-adder and https://greasyfork.org/en/scripts/26273-steam-store-game-owned-checker

  1. // ==UserScript==
  2. // @name Steam Game Marker (Humble Bundle)
  3. // @icon https://humblebundle-a.akamaihd.net/static/hashed/47e474eed38083df699b7dfd8d29d575e3398f1e.ico
  4. // @namespace jaege
  5. // @version 1.0
  6. // @description Adds steam links and wishlist/owned/unowned icons to Humble Bundle games. Please login Steam's official website in your broswer first. Based on https://greasyfork.org/scripts/27373-humble-bundle-steam-links-adder and https://greasyfork.org/en/scripts/26273-steam-store-game-owned-checker
  7. // @author jaege
  8. // @contributor Royalgamer06
  9. // @include *://www.humblebundle.com/*
  10. // @grant GM_xmlhttpRequest
  11. // @run-at document-idle
  12. // @connect api.steampowered.com
  13. // @connect store.steampowered.com
  14. // @require https://code.jquery.com/jquery-3.3.1.min.js
  15. // ==/UserScript==
  16.  
  17.  
  18. // ==Configuration==
  19. var selectors = ["em",
  20. ".entity-title",
  21. ".deal-title",
  22. ".product-name",
  23. ".text-holder > h2",
  24. ".product-title > h2",
  25. "h1[data-entity-kind=product]",
  26. ".desktop:has(.hb-steam) .dd-image-box-caption",
  27. ".humble-original-title",
  28. ".game-name > h4",
  29. ".sr-key-heading > span",
  30. ".heading-text > h4"];
  31. const wishlistIcon = "❤"; // HTML entity code for '❤' (default).
  32. const wishlistColor = "hotpink"; // Color of the icon for wishlisted apps.
  33. const ownedIcon = "✔"; // HTML entity code for '✔' (default).
  34. const ownedColor = "green"; // Color of the icon for owned apps and subs.
  35. const unownedIcon = "✘"; // HTML entity code for '✘' (default).
  36. const unownedColor = "red"; // Color of the icon for unowned apps and subs.
  37. // ==/Configuration==
  38.  
  39. // ==Code==
  40. this.$ = this.jQuery = jQuery.noConflict(true);
  41.  
  42. var userdata = [];
  43. var wishlist = [];
  44. var ownedApps = [];
  45. //var ownedPackages = [];
  46. var applist = [];
  47. GM_xmlhttpRequest({
  48. method: "GET",
  49. url: "http://store.steampowered.com/dynamicstore/userdata/",
  50. onload: function(response) {
  51. userdata = JSON.parse(response.responseText);
  52. wishlist = userdata.rgWishlist;
  53. ownedApps = userdata.rgOwnedApps;
  54. //ownedPackages = userdata.rgOwnedPackages;
  55. console.log("userdata loaded");
  56.  
  57. var selector = selectors.join(":not(.steamified):not(a):not(:has(a)), ") + ":not(.steamified):not(a):not(:has(a))";
  58. GM_xmlhttpRequest({
  59. method: "GET",
  60. url: "https://api.steampowered.com/ISteamApps/GetAppList/v2/",
  61. onload: function(response) {
  62. applist = JSON.parse(response.responseText).applist.apps;
  63. console.log("applist loaded");
  64. $(document).on("contentchanged", selector, function() {
  65. steamify(this);
  66. }).ready(function() {
  67. var domwatcher = setInterval(function() {
  68. $(selector).each(function() {
  69. steamify(this);
  70. }, 100);
  71. });
  72. });
  73. }
  74. });
  75. }
  76. });
  77.  
  78. function steamify(titleElem) {
  79. $(titleElem).addClass("steamified");
  80. setTimeout(function() {
  81. var title = $(titleElem).text().toLowerCase().replace(/\(early access\)|\(pre\-order\)|\:|\-|\–|\\|\/|\™|\®| |\'|\.|\?|\!/g, "").trim();
  82. var obj = applist.filter(function(v) { return v.name.toLowerCase().replace(/\:|\-|\–|\\|\/|\™|\®| |\'|\.|\?|\!/g, "").trim() == title; })[0];
  83. if (obj !== undefined) {
  84. var appID = obj.appid;
  85. var lcs = new Date().toLocaleString();
  86. var icon;
  87. if (ownedApps.includes(appID)) { //if owned
  88. icon = "<span style='color: " + ownedColor + "; cursor: help;' title='Game or DLC (" + appID + ") owned on Steam\nLast updated: " + lcs + "'> " + ownedIcon + "</span>"; //✔
  89. } else { //else not owned
  90. if (wishlist.includes(appID)) { //if wishlisted
  91. icon = "<span style='color: " + wishlistColor + "; cursor: help;' title='Game or DLC (" + appID + ") wishlisted on Steam\nLast updated: " + lcs + "'> " + wishlistIcon + "</span>"; //❤
  92. } else { //else not wishlisted
  93. icon = "<span style='color: " + unownedColor + "; cursor: help;' title='Game or DLC (" + appID + ") not owned on Steam\nLast updated: " + lcs + "'> " + unownedIcon + "</span>"; //✘
  94. }
  95. }
  96. $(titleElem).append(icon);
  97. $(titleElem).replaceWith("<a href='http://store.steampowered.com/app/" + appID + "/' target='_blank'>" + titleElem.outerHTML + "</a>");
  98. }
  99. }, 0);
  100. }
  101.  
  102. // ==/Code==