Last active
December 6, 2019 22:51
-
-
Save cold-logic/c76e307922be71dea5c0453934a4807b to your computer and use it in GitHub Desktop.
Copies a list of humble bundle games into your clipboard for inventory managment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copies a list of humble bundle games into your clipboard for inventory managment | |
* Designed for the receipt/download pages: | |
* https://www.humblebundle.com/downloads?key={key} | |
*/ | |
{ | |
console.clear() | |
// Feel free to customize these tags as you wish | |
const tags = ['#Humble'].join(' ') | |
// DOM query selectors | |
const redeemableTitles = Array.from(document.querySelectorAll('.key-redeemer h4')) | |
const downloadableTitles = Array.from(document.querySelectorAll('.gameinfo .title')) | |
// Array reducer, reduces titles into one newline delimited string | |
const titlesReducer = (pre, cursor, idx) => `${pre}${(idx === 0) ? '' : `\n`}${cursor} ${tags}` | |
let output = [...redeemableTitles, ...downloadableTitles] | |
.map(title => title.innerText) | |
.reduce(titlesReducer, '') | |
// Fn to pipe output to the clipboard and the console | |
const copyAndLog = output => { | |
[copy, console.log].reduce((a, b) => arg => a(arg) || b(arg))(output) | |
} | |
copyAndLog(output) | |
} |
@sgtpepper901 - To use this; You open up the Humble bundle purchase screen, and then paste this code into the JavaScript console in your browser's dev tools. You can access the dev tools by right clicking anywhere in the page and clicking the "Inspect" menu item.
This code finds and collects all of the game names into a list. Then it copies the list into your clipboard for pasting into services like Workflowy or Dynalist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, I'm a noob, how do I use this?