// ==UserScript== // @name humble-bundle-extra // @namespace https://humblebundle.com // @version 1.0.0 // @description User script for humble bundle. Adds steam store links to all games and marks already owned games // @match *://www.humblebundle.com/* // @author MrMarble // @grant GM_xmlhttpRequest // @connect api.steampowered.com // @connect store.steampowered.com // @source https://github.com/MrMarble/humble-bundle-extra // @downloadURL none // ==/UserScript== !function(){"use strict";const e=e=>new Promise(((t,a)=>{GM_xmlhttpRequest({...e,onload:t,onabort:a})})),t=(()=>{const e=document.createElement("div");return function(t){return t&&"string"==typeof t&&(t=(t=t.replace(/]*>([\S\s]*?)<\/script>/gim,"")).replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),e.innerHTML=t,t=e.textContent,e.textContent=""),t}})(),a=e=>t(e).replace(/[\u{2122}\u{00AE}]/gu,"").toLowerCase(),n=(e,t,a)=>{return n=`\n
\n
\n \n \n \n
\n
\n \n
\n
\n
\n

${t}

\n
\n
\n ${a}\n
\n
\n
\n
\n
\n `,r=document.createElement("template"),n=n.trim(),r.innerHTML=n,r.content.firstChild;var n,r},r="&&hh_extras&&",o="&&hh_extras_owned&&",i=async()=>{const t=await e({url:"https://api.steampowered.com/ISteamApps/GetAppList/v0002/?format=json",method:"GET"}),{applist:n}=JSON.parse(t.responseText),r={};return n?.apps?.forEach((({name:e,appid:t})=>{r[a(e)]=t})),r},l=async()=>{const t=await e({url:"https://store.steampowered.com/dynamicstore/userdata/",method:"GET"}),{rgOwnedApps:a}=JSON.parse(t.responseText);return a};document.querySelector("div.inner-main-wrapper div.bundle-info-container")&&async function(){const e=await(async e=>{let t={};return void 0?(t=await i(),localStorage.setItem(r,JSON.stringify(t))):(t=localStorage.getItem(r))?t=JSON.parse(t):(t=await i(),localStorage.setItem(r,JSON.stringify(t))),t})(),t=await(async e=>{let t=[];return void 0?(t=await l(),localStorage.setItem(o,JSON.stringify(t))):(t=localStorage.getItem(o))?t=JSON.parse(t):(t=await l(),localStorage.setItem(o,JSON.stringify(t))),t})(),s=0!=t.length;s||function(){const e=n("hb-exclamation-circle","You are not logged in to the steam store",'

Information about games already in your library will not be available.

\n

You can login using this link. Reload the page after login to load the games in your library.

');document.querySelector("#site-modal").appendChild(e)}(),document.querySelectorAll(".front-page-art-image-text").forEach((n=>{let r;(r=e[a(n.textContent)])&&(n.innerHTML=`${n.textContent}`,s&&t.includes(r)&&(n.parentElement.parentElement.querySelector(".dd-caption-lock").remove(),n.firstChild.style.color="#7f9a2f"))}))}()}();