var reloading = 600000; // 10 minutes
var trying = 10000 ; // 20 seconds
var minPoints = 10;
var minLevel = 0;
var timeBetweenClicks = 2000;
(function() {
'use strict';
removeAlreadyHave();
removeWithLevelRestriction();
realoadPage(reloading);
if ($(".coins-amount strong").html() < minPoints ) {
realoadPage(reloading);
return;
}
if (document.getElementsByTagName("aside").length > 0) {
setInterval(function(){
document.getElementsByTagName("aside")[0].click();
}, timeBetweenClicks);
}
setInterval(function(){
var page = calculateNextPage();
console.log(page);
if (page > 15) {
page = 1;
}
window.location="https://www.indiegala.com/giveaways/[NUM_PAGE]/expiry/asc".replace("[NUM_PAGE]", page);
}, trying);
})();
/***********************************************************
* Utility Functions
**********************************************************/
function removeAlreadyHave()
{
while (document.getElementsByClassName("on-steam-library").length > 0 ){
document.getElementsByClassName("on-steam-library")[0].parentNode.remove();
}
}
/***********************************************************
* Utility Functions
**********************************************************/
function calculateNextPage()
{
var page = window.location.href.replace("https://www.indiegala.com/giveaways/","").replace("/expiry/asc","");
return parseInt(page)+1;
}
function realoadPage(miliseconds) {
setInterval(function(){
window.location.reload();
}, miliseconds);
}
function removeWithLevelRestriction()
{
$(".cover-cont").remove();
var aEliminar = [];
console.log(1);
for (var i = 0; i < $(".type-level-cont").length ; i++) {
for (var x = minLevel + 1; x < 10 ; x++)
{
if ($(".type-level-cont")[i].innerHTML.indexOf(x+"+") != -1)
{
aEliminar.push($(".type-level-cont")[i]);
}
}
}
console.log("tamano inicial: " + aEliminar.length);
while (aEliminar.length > 0) {
var node = aEliminar.pop();
node.remove();
console.log("a borrar" + aEliminar.length);
}
}
/***********************************************************
* Override Functions
**********************************************************/
window.confirm = function (message, callback, caption) {
return true;
};