// ==UserScript==
// @name Giveaway Killer
// @namespace https://github.com/gekkedev/GiveawayKiller
// @version 1.1.7
// @description Semi-automatic tool for Steam-related giveaway websites
// @author gekkedev
// @match *://*.marvelousga.com/*
// @match *://*.dupedornot.com/*
// @match *://*.indiegala.com/*
// @match *://*.dogebundle.com/*
// @match *://*.giveaway.su/*
// @match *://*.steamgifts.com/*
// @match *://*.simplo.gg/*
// @match *://*.giveawayhopper.com/*
// @match *://*.cubicbundle.com/*
// @match *://*.treasuregiveaways.com/*
// @match *://*.goldengiveaways.org/*
// @match *://*.bananagiveaway.com/*
// @match *://*.grabfreegame.com/*
// @match *://*.gamingimpact.com/*
// @match *://*.gamehag.com/*
// @match *://*.gamecode.win/*
// @match *://*.gleam.io/*
// @match *://*.steamcommunity.com/openid/login*
// @match *://*.steamcommunity.com/oauth/login*
// @match *://*.steamcommunity.com/groups/*
// @grant GM.getValue
// @grant GM.setValue
// @updateURL https://raw.githubusercontent.com/gekkedev/GiveawayKiller/master/giveawayKiller.user.js
// @downloadURL https://raw.githubusercontent.com/gekkedev/GiveawayKiller/master/giveawayKiller.user.js
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @require https://cdnjs.cloudflare.com/ajax/libs/notify/0.4.2/notify.min.js
// @require https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js
// @run-at document-end
// ==/UserScript==
(async () => {
J = jQuery.noConflict(true); //to prevent i.e. broken buttons when a site uses jquery too
J.extend(J.expr[':'], { //https://stackoverflow.com/a/4936066
'containsi': function(elem, i, match, array)
{
return (elem.textContent || elem.innerText || '').toLowerCase()
.indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
killerNotice = function(message, type = "info") { //types: success/info/warn/error
console.log(message);
J.notify("GiveawayKiller v" + GM_info.script.version + ": " + message, {
autoHideDelay: 10000,
className: type
});
};
/* Configuration
* Determine what to do for this page based on what's defined in the "config" variable
*
* hostname: String
* The hostname of the site we're setting the config for. Must be the same as what's defined
* as @match in the metadata block above.
*
* ads: Boolean
* This tells us if the site we visit has ads (this refers to banners of any size, mostly from Google). We'll then trigger the removal function for that.
*
* autologin: String
* This is a selector for a link which has to be visited in order to get forwarded to the login page.
*
* trigger: Array of Functions
* Triggers may or may not be site specific; they are usually for task solving and can be reused on unmodified instances of poorly programmed website scripts.
*
* clickables: Array of String
* These are CSS Selectors which will be buttons to be clicked (in ascending order). Some may not be clickable but each click that doesn't need to be done is already a success.
*/
var removePopups = function(){
//killerNotice("removing popups!");
removeElement("a[id^='popup']");
//does not work on all sites, a workaround is in the next paragraph
J(document).ready(function(){
J("html").unbind("click");
});
//necessary for gamecode.win and dupedornot.com
var d = new Date();
var todayStr = (d.getUTCMonth() + 1) + "/" + d.getUTCDate() + "/" + d.getUTCFullYear();
document.cookie = "haveVisited1=" + todayStr + "; path=/";
//setTimeout(removePopups, 1000);
};
var fakeClickLinks = function() {
J("form[action*='verify_click.php']").trigger("submit");
};
var solveGamehagUsernameCheck = function() {
//"Kruemel" //some random user, just pick another one from the ranklist in case they block this user ;-)
};
scanForElement = function(identifiers) { //iterates through elements and returns true if all elements exist at least once
//console.log("found " + ident + " " + jQuery(ident).length + " time(s)");console.log(jQuery(ident));
if (typeof identifiers != "object") identifiers = [identifiers]; //wrap it as array in case it isn't one
counter = Object.keys(identifiers).length;
J.each(identifiers, function(i, ident) {
if (J(ident).length >= 1) {
counter--;
} else {
console.log('cannot find ' + ident);
}
});
return counter == 0;
};
hideElement = function(ident) {
if (scanForElement(ident)) {
J(ident).hide();
}
};
removeElement = function(ident) {
J(ident).remove();
};
var visitLink = function(ident){
window.location.replace(J(ident).attr("href"));
};
var removeGoogleAds = function(){
if (scanForElement("ins[class*='adsbygoogle']")) {
killerNotice("Google ads found, removing now!");
removeElement("ins[class*='adsbygoogle']");
setTimeout(removeGoogleAds, 1000);
}
};
var getEncapsedString = function(input, delimiter) {//just gets the first occurrence
var startpos = input.indexOf(delimiter) + delimiter.length;
var endpos = input.indexOf(delimiter, startpos);
return input.substring(startpos, endpos);
};
var getRandomInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
//stackoverflow.com/a/1314389
var checkGetParameter = function(parameterName) {
var url = window.location.href;
if(url.indexOf('?' + parameterName) != -1)
return true;
else if(url.indexOf('&' + parameterName) != -1)
return true;
return false
}
//stackoverflow.com/a/5448595
var returnGetParameter = function(parameterName) {
var result = null,
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
});
return result;
};
/*var autoJoinGroups = function() {
//giveaway.su
var groups = $("button[data-type='steam.group']");
for (var i = 0; i < groups.length; i++) {
var group = groups[i];
$.get("https://steamcommunity.com/profiles/"+$("aside[data-steam-id]").data("steam-id")+"/groups/").always(function(jqXHR) {
var regexp = new RegExp("href=\"javascript:leaveGroupPrompt\\('"+$(group).data("check")+"',", "g");
if (jqXHR && regexp.test(jqXHR))
toggleActionButton(button);
else
$(button).prop("disabled", false).find(".glyphicon.spin").removeClass("spin");
});
group.remove();
}
};*/
var taskSkipper_1 = function() {//giveaway.su/varlick
if (J("article .extension").length) {
J("article .extension").addClass("installed");
var timestamp = J("article .extension").data("timestamp");
var csrf = J("article .extension").data("csrf");
var extension = md5(timestamp+""+csrf);
var secret = J("article .extension").data("secret");
J.get(window.location.pathname+"?extension="+extension+"×tamp="+timestamp+"&csrf="+csrf+(secret ? "&secret="+secret : ""), function(response) {
J("article").replaceWith(response);
//this is the extension version and should not depend on manual updates
J("article").attr("extension-version", "chrome-3.4.9");//+chrome.runtime.getManifest().version);
var button = J("#getKey a");
var actions = 0;
J("#actions [data-action-id]").each(function(i,el){
actions += parseInt(J(el).data("action-id"));
if (J(el).find("button[data-type='steam.curator']").length) {
J(el).fadeOut();
} else if (J(el).find("button[data-type='youtube.subscribe']").length) {
J(el).fadeOut();
} else if (J(el).find("button[data-type='twitter.follow']").length) {
J(el).fadeOut();
} else if (J(el).find("button[data-type='steam.game.wishlist']").length) {
J(el).fadeOut();
} else if (J(el).find("td:contains('Invite')").length) {
J(el).fadeOut();
}
});
J(button).attr("href", J(button).attr("href")+"&actions="+md5(actions)).removeClass("disabled");
J("#getKey").prepend("Giveaway Killer by gekkedev has skipped some tasks for you, because this site is trying to manipulate the Steam store and to get access over your private data. Key claiming does usually work when you have joined all the required groups. Please use the Giveaway Helper by Citrinate in order to join groups easier. Linking accounts happens at your own risk and is a possible reason of unwanted actions commited via your account (account theft, unwanted purchases, etc.) and is qualifying you for punishments regarding Steam T.O.S. violations.
");
});
}
};
var taskSkipper_2 = function() {//goldengiveaways
var tasks = J("a[onclick*='task()']");
if (tasks.length) {
tasks.each(function(counter, element){
J.get(element.href);
});
location.reload();
} else {
J(".giveaway-new").last().prepend("