// ==UserScript==
// @name Gleam.solver
// @namespace --Ссылка удалена--
// @description Automates Gleam.io giveaways
// @author Citrinate
// @version 1.5.4
// @match
https://gleam.io/*
// @match
https://player.twitch.tv/
// @connect steamcommunity.com
// @connect twitter.com
// @connect twitch.tv
//
@GranT GM_getValue
//
@GranT GM_setValue
//
@GranT GM_addStyle
//
@GranT GM_xmlhttpRequest
//
@GranT unsafeWindow
// @updateURL --Ссылка удалена--
// @downloadURL --Ссылка удалена--
// @require --Ссылка удалена--
// @require
https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @run-at document-end
// ==/UserScript==
(function() {
/**
*
*/
var gleamSolver = (function() {
var gleam = null,
script_mode = null,
authentications = {},
valid_modes = [
"undo_all", // Instant-win mode: There should be no public record of any social media activity on the user's accounts.
"undo_some", // Instant-win+ mode: Mark all entries and remove all possible public record of social media activity on the user's accounts.
"undo_none", // Raffle mode: All public record of social media activity should remain on the user's accounts.
"undo_none_plus" // Raffle+ mode: All public record of social media activity should remain on the user's accounts, complete all entries even if they may disqualify in a raffle.
];
/**
* Choose a default mode based on the giveaway type
*/
function determineMode() {
if(gleam.isReward()) {
// Instant-win mode
return GM_getValue("default_instant_mode", "undo_all");
} else {
// Raffle mode
return GM_getValue("default_raffle_mode", "undo_none");
}
}
/**
*
@return {Boolean} undo - True if we're meant to undo the entries, false otherwise
*/
function undoEntry() {
return script_mode != "undo_none" && script_mode != "undo_none_plus";
}
/**
* Check to see what accounts the user has linked to gleam
*/
function checkAuthentications() {
if(gleam.contestantState.contestant.authentications) {
var authentication_data = gleam.contestantState.contestant.authentications;
for(var i = 0; i < authentication_data.length; i++) {
var current_authentication = authentication_data
;
authentications[current_authentication.provider] = current_authentication;
}
}
}
/**
* Check to see if we've got a necessary account linked for an entry
* @return {Boolean} has_authentications - True for we have the authentications, false for otherwise
*/
function hasAuthentications(entry_method) {
if(entry_method.requires_authentication) {
// The entry requires an account linked
if(authentications[entry_method.provider] && !authentications[entry_method.provider].expired) {
// And that account is linked
return true;
}
} else {
return true;
}
return false;
}
/**
* Check to see if we've provided enough details for an entry
* @return {Boolean} has_enough_details - True for has provided enough details, false for otherwise
*/
function hasEnoughDetails(entry_method) {
if(!gleam.isReward() ||
entry_method.provider === "email" ||
gleam.campaign.require_contact_info
) {
// Information is required
if(gleam.contestantState.contestant.id &&
gleam.contestantState.contestant.email &&
gleam.contestantState.contestant.name &&
(!gleam.campaign.additional_contestant_details || !!gleam.contestantState.contestant.completed_details)
) {
// And we've already provided it
return true;
}
} else {
return true;
}
return false;
}
/**
* Generate a random amount of time to wait between handling each entry
* @param {Boolean} max - When true, returns the maximum possible value for delay
* @return {Number} delay
*/
function getDelay(max) {
var random = max === true ? () => 1 : Math.random,
entry_delay_min = (random() * 250) + 900,
entry_delay_max = entry_delay_min * ((random() * 1) + 1.5),
entry_delay_slow_multiplier_min = (random() * 0.5) + 1.0,
entry_delay_slow_multiplier_max = (random() * 0.5) + 2.0,
entry_delay_slow_chance = GM_getValue("entry_delay_slow_chance", false);
...