Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sergiosusa/4ddd59e928cc96e37c354460e5e54b59 to your computer and use it in GitHub Desktop.
Save sergiosusa/4ddd59e928cc96e37c354460e5e54b59 to your computer and use it in GitHub Desktop.
Copia la lista de los juegos de la patalla de Keys del Humble Bundle.
// ==UserScript==
// @name Copy Humble Bundle Games Unreveal
// @namespace http://sergiosusa.com
// @version 0.1
// @description Copy all name of games from the HB keys list
// @author Sergio Susa ([email protected])
// @match https://www.humblebundle.com/home/keys
// @grant GM_setClipboard
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
var results = [];
(function() {
'use strict';
$.noConflict();
jQuery( document ).ready(function() {
setTimeout(insertGraphicElements,3000);
});
})();
function insertGraphicElements()
{
var element = jQuery('div.header > div:nth-child(1) > h1')[0];
var anchor = document.createElement('a');
anchor.innerHTML = '( Copy List Of Games )';
anchor.href = '#';
anchor.style = 'text-align: center;display: block;';
anchor.onclick = startCopying;
element.appendChild(anchor);
}
function startCopying(){
var intervalId = setInterval(function(){
var titulos = jQuery("td.game-name > h4");
jQuery.each(titulos, function(index, value){
results.push(value.innerText);
});
var btnNext = jQuery(".hb-chevron-right")[0];
if (btnNext == undefined){
clearInterval(intervalId);
var textResult = "";
jQuery.each(results, function(index, value){
textResult += value + "\n";
});
toClipboard(textResult);
alert("Se ha copiado toda las lista al portapapeles");
return;
} else {
btnNext.click();
}
}, 5000);
}
/***********************************************************
* Utility Functions
**********************************************************/
function toClipboard(text)
{
GM_setClipboard(text);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment