NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Hourly Faucets Rotator
// @namespace Hourly Faucets Rotator
// @version 0.2
// @description Script to claim faucets
// @author steamfaucet
// @match https://*.coinfaucet.io/*
// @match https://*.freematic.com/*
// @match https://*.freecardano.com/*
// @match https://*.freenem.com/*
// @match https://*.freebitcoin.io/*
// @match https://*.freesteam.io/*
// @match https://*.freetether.com/*
// @match https://*.freeusdcoin.com/*
// @match https://*.freepancake.com/*
// @match https://*.freebinancecoin.com/*
// @match https://*.free-tron.com/*
// @match https://*.freeethereum.com/*
// @match https://*.freedash.io/*
// @match https://*.freeneo.io/*
// @match https://*.free-doge.com/*
// @match https://*.free-ltc.com/*
// @match https://*.freechainlink.io/*
// @match https://*.freeshibainu.com/*
// @match https://*.www.free-litecoin.com/*
// @match https://*.www.free-ethereum.io/*
// @match https://*.free-litecoin.com/*
// @match https://*.free-ethereum.io/*
// @match https://*.freebittorrent.com/*
// @match https://*.freebfg.com/*
// @match https://*.freebitco.in/*
// @match https://*.www.flashfaucet.com/*
// @match https://*.darkusd.com/*
// @match https://*.freecryptom.com/*
// @match https://freeth.in/*
// @match https://bnbfree.in/*
// @match https://freetrx.in/*
// @match https://dogefree.in/*
// @match https://btcfre.com/*
// @match https://ethfre.com/*
// @match https://freebnbnow.com/*
// @match https://bnbpi.com/*
// @match https://fredoge.com/*
// @match https://tronths.com/*
// @match https://freeudt.com/*
// @match https://miningsol.com/*
// @match https://maticfreee.com/*
// @match https://bnbfe.com/*
// @match https://freearb.co/*
// @match https://www.bestchange.com/*
// @match https://bnbpick.io/*
// @match https://litepick.io/*
// @match https://solpick.io/*
// @match https://dogepick.io/*
// @match https://tronpick.io/*
// @match https://maticpick.io/*
// @connect t.me
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
// @noframes
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @grant window.close
// ==/UserScript==
(function() {
'use strict';
//==========================================================================================================================
// Enter yuor faucetpay wallet address and BNB wallet address wherever it is required
var faucetpayEmail = ""; //Ex: var faucetpayEmail = "*****@gmail.com"
var bitcoin="";
var binance="";
var bitcoincash ="";
var dash ="";
var dogecoin ="";
var digibyte="";
var ethereum="";
var feyorra="";
var litecoin ="";
var solana ="";
var tron ="";
var tether="";
var zcash ="";
var matic = "";
var arbitrumWallet = "";
//List of the faucet websites
//Comment the lines of url if you don't use them
//Enter your login and password if you wish you login automatically
//You need to be careful while inputting the login and password in order to avoid account locks
var websiteData = [
{url : "https://coinfaucet.io", login: "", password: ""}, // Ex: login: "test@gmail.com", password: "test@123"
{url : "https://freecardano.com", login: "", password: ""},
{url : "https://freenem.com", login: "", password: ""},
{url : "https://freebitcoin.io", login: "", password: ""},
{url : "https://freesteam.io", login: "", password: ""},
{url : "https://freetether.com", login: "", password: ""},
{url : "https://freeusdcoin.com", login: "", password: ""},
{url : "https://freebinancecoin.com", login: "", password: ""},
{url : "https://free-tron.com", login: "", password: ""},
{url : "https://freeethereum.com", login: "", password: ""},
{url : "https://freedash.io", login: "", password: ""},
{url : "https://freeneo.io", login: "", password: ""},
{url : "https://free-doge.com", login: "", password: ""},
{url : "https://free-ltc.com", login: "", password: ""},
{url : "https://freeshibainu.com", login: "", password: ""},
{url : "https://freeth.in", login: "", password: ""},
{url : "https://bnbfree.in/", login: "", password: ""},
{url : "https://freetrx.in/", login: "", password: ""},
{url : "https://dogefree.in/", login: "", password: ""},
{url : "https://freematic.com", login: "", password: ""},
{url : "https://freepancake.com", login: "", password: ""},
{url : "https://freecryptom.com", login: "", password: ""},
{url : "https://freebfg.com", login: "", password: ""},
{url : "https://freebittorrent.com", login: "", password: ""},
{url : "https://www.free-litecoin.com", login: "", password: ""},
{url : "https://www.free-ethereum.io", login: "", password: ""},
{url : "https://freebitco.in", login: "", password: ""},
{url : "https://bnbpick.io/faucet.php", login: "", password: ""},
{url : "https://litepick.io/faucet.php", login: "", password: ""},
{url : "https://solpick.io/faucet.php", login: "", password: ""},
{url : "https://dogepick.io/faucet.php", login: "", password: ""},
{url : "https://tronpick.io/faucet.php", login: "", password: ""},
{url : "https://maticpick.io/faucet.php", login: "", password: ""},
// No username or password is required for the below mentioned website list if you already entered your faucetpay wallet address above
{url : "https://www.flashfaucet.com/faucet", address: faucetpayEmail},
{url : "https://www.bestchange.com/", address: bitcoin},
{url : "https://btcfre.com/", address: bitcoin},
{url : "https://ethfre.com", address: ethereum},
{url : "https://freebnbnow.com", address: binance},
{url : "https://bnbpi.com/", address: binance},
{url : "https://bnbfe.com/", address: binance},
{url : "https://fredoge.com/", address: dogecoin},
{url : "https://tronths.com/", address: tron},
{url : "https://freeudt.com/", address: tether},
{url : "https://miningsol.com/", address: solana},
{url : "https://maticfreee.com/", address: matic},
{url : "https://freearb.co", address: arbitrumWallet},
];
//==========================================================================================================================
//Do not run if it is a pop up window
if(window.name){
return;
}
if(window.history.length <3 && window.location.href.includes("dashboard")){
window.close();
}
if(window.location.href.includes("games")){
window.location.href="/free";
}
setInterval(function(){
if(window.location.href.includes("games")){
window.location.href="/free";
}
},10000);
//Message selectors are for success or failure to move on to the next website
//Add only domain name in website as mentioned below. Follow the same pattern.
//Use arrays wherever it is required
//Login Selectors are in the format email,password and button
var websiteMap = [
{website : ["freepancake.com","coinfaucet.io","freecardano.com", "freenem.com", "freebitcoin.io", "freesteam.io", "freetether.com",
"freeusdcoin.com", "freebinancecoin.com", "free-tron.com", "freeethereum.com", "freedash.io", "freeneo.io",
"free-doge.com", "free-ltc.com", "freechainlink.io", "freeshibainu.com","freebittorrent.com","freebfg.com",
"freecryptom.com","freematic.com"],
defaultButtonSelectors: [".p-button.p-component.p-button-lg",".main-button-2.roll-button.bg-2",".btn.btn-primary.text-dark.w-100.toggleLogin.rounded-xl"],
loginSelectors:[".form-control[name=email]",".form-control[name=password]","#login-btn"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: [".timeout-wrapper .seconds .digits", ".timeout-wrapper .minutes .digits", ".text-3xl"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received", "countdown to next roll"]},
{website : ["free-litecoin.com","free-ethereum.io"],
loginSelectors:["#loginform .form-control[type=email]","#loginform .form-control[type=password]","#loginbutton"],
loginCaptcha : true,
captchaButtonSubmitSelectors: ["#loginbutton","#roll",".btn.btn-success"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#cislo1","#cislo2"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"]},
{website : ["dogefree.in","freebitco.in","freeth.in","bnbfree.in","freetrx.in"],
loginSelectors:["#login_form_btc_address","#login_form_password","#login_button"],
captchaButtonSubmitSelectors: ["#free_play_form_button"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 180000
},
{website : ["btcfre.com", "freebnbnow.com", "fredoge.com", "tronths.com", "miningsol.com", "maticfreee.com", "bnbfe.com"],
loginSelectors:["input[type=text][placeholder", "button.btn.btn-warning"],
defaultButtonSelectors: ["td a.btn.btn-sm.btn-outline-success"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 30000
},
{website : ["ethfre.com"],
loginSelectors:["input[type=text][placeholder", "button.btn.btn-secondary"],
defaultButtonSelectors: ["td a.btn.btn-sm.btn-outline-secondary"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 30000
},
{website : ["bestchange.com"],
defaultButtonSelectors: ["#tab_bonus > a"],
loginSelectors:["#bonus_purse"],
loginCaptcha : true,
captchaButtonSubmitSelectors: ["#bonus_button"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result","#bonus_status", "#bonus_button"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received", "added to your balance", "Time left"],
timeoutbeforeMovingToNextUrl: 120000
},
{website : ["bnbpi.com", "freearb.co"],
loginSelectors:["input[type=text][placeholder", "button.btn.btn-primary"],
defaultButtonSelectors: ["td a.btn.btn-sm.btn-outline-primary"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 30000
},
{website : ["freeudt.com"],
loginSelectors:["input[type=text][placeholder", "button.btn.btn-success"],
defaultButtonSelectors: ["td a.btn.btn-sm.btn-outline-success"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 30000
},
{website : ["bnbpick.io", "solpick.io", "litepick.io", "dogepick.io", "tronpick.io", "maticpick.io"],
loginSelectors: ["input[type=email]", "input[type=password]", "#process_login"],
loginCaptcha : true,
captchaButtonSubmitSelectors: ["#process_login, button[type=submit]"],
timeoutbeforeMovingToNextUrl: 120000
},
{website : ["flashfaucet.com"],
defaultButtonSelectors: ["a[href='login']"],
loginSelectors:["input[type=text]","button[type=submit]"],
captchaButtonSubmitSelectors: [".btn.btn-primary"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger", "#newClaim"],
timeoutMessageSelectors: ["#time_remaining", "#demo"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","You have won","You have received"],
additionalFunctions: usdFaucets}
];
//HtmlEvents dispatcher
function triggerEvent(el, type) {
try{
var e = document.createEvent('HTMLEvents');
e.initEvent(type, false, true);
el.dispatchEvent(e);
}catch(exception){
console.log(exception);
}
}
function toggleCaptcha(selector, index){
if( document.querySelector(selector)){
document.querySelector(selector).selectedIndex = index;
}
var targetNode = document.querySelector(selector);
if (targetNode) {
setTimeout(function() {
triggerEvent(targetNode, 'change');
}, 5000);
}
}
async function getPromoCode(){
// Function to extract promo codes from HTML
function extractPromoCodes(html) {
const promoCodes = [];
const regex = /Promo Code = <b>(.*?)<\/b>/g;
let match;
while ((match = regex.exec(html)) !== null) {
promoCodes.push(match[1]);
}
return promoCodes;
}
async function getPromoCodes(url) {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function(response) {
const promoCodes = extractPromoCodes(response.responseText);
resolve(promoCodes);
},
onerror: function(error) {
reject(error);
}
});
});
}
// Function to check if a day has passed since the last execution
function isDayPassed() {
if(!GM_getValue( 'lastExecution')){
return 1;
}
const lastExecution = GM_getValue('lastExecution');
console.log(lastExecution);
const now = Date.now();
const oneDay = 24 * 60 * 60 * 1000; // milliseconds in a day
return now - lastExecution >= oneDay;
}
// Function to update the last execution time
function updateLastExecution() {
GM_setValue('lastExecution', Date.now());
}
// Check if a day has passed since the last execution
if (isDayPassed()) {
const url = 'https://t.me/s/freecryptosfaucets';
try {
const promoCodes = await getPromoCodes(url);
console.log('Promo Codes:', promoCodes);
updateLastExecution();
if(promoCodes.length > 0){
GM_setValue('lastPromoCode', promoCodes[promoCodes.length -1]);
return promoCodes[promoCodes.length -1];
}else {
return "";
}
} catch (error) {
console.error('Error fetching URL:', error);
return "";
}
} else{
console.log("Day is not passed");
return "";
}
}
//Check if a string is present in Array
String.prototype.includesOneOf = function(arrayOfStrings) {
//If this is not an Array, compare it as a String
if (!Array.isArray(arrayOfStrings)) {
return this.toLowerCase().includes(arrayOfStrings.toLowerCase());
}
for (var i = 0; i < arrayOfStrings.length; i++) {
if (this.toLowerCase().includes(arrayOfStrings[i].toLowerCase())) {
return true;
}
}
return false;
}
var websiteDataValues = {};
//Get selector details from the websiteMap
for (let value of Object.values(websiteMap)) {
if(window.location.href.includesOneOf(value.website)){
websiteDataValues.beforeLoginButton = value.beforeLoginButton;
websiteDataValues.inputTextSelector= value.inputTextSelector;
websiteDataValues.inputTextSelectorButton = value.inputTextSelectorButton;
websiteDataValues.defaultButtonSelectors = value.defaultButtonSelectors;
websiteDataValues.claimButtonSelector = value.claimButtonSelector;
websiteDataValues.captchaButtonSubmitSelectors = value.captchaButtonSubmitSelectors;
websiteDataValues.loginSelectors = value.loginSelectors;
websiteDataValues.loginCaptcha = value.loginCaptcha;
websiteDataValues.allMessageSelectors = value.allMessageSelectors;
websiteDataValues.messagesToCheckBeforeMovingToNextUrl = value.messagesToCheckBeforeMovingToNextUrl;
websiteDataValues.withdrawPageUrl = value.withdrawPageUrl;
websiteDataValues.withdrawEnabled = value.withdrawEnabled;
websiteDataValues.balanceSelector = value.balanceSelector;
websiteDataValues.withdrawMinAmount = value.withdrawMinAmount;
websiteDataValues.successMessageSelectors = value.successMessageSelectors;
websiteDataValues.toggleCaptchaSelector = value.toggleCaptchaSelector;
websiteDataValues.toggleCaptchaSelectorIndex = value.toggleCaptchaSelectorIndex;
websiteDataValues.timeoutbeforeMovingToNextUrl = value.timeoutbeforeMovingToNextUrl;
websiteDataValues.timeoutMessageSelectors = value.timeoutMessageSelectors;
websiteDataValues.additionalFunctions = value.additionalFunctions;
break;
}
}
//Identify which coin to input, based on the url input
//If the URL does not contain the coin, then use the default from the domain name
var count = 0;
var addressAssigned = false;
for (let value of Object.values(websiteData)) {
count = count + 1;
if(window.location.href.includes("/" + value.regex)){
addressAssigned = true;
break;
}
}
var login = "";
var password = "";
var address = "";
//If URL does not have coin, check the default from the domain name
if(!addressAssigned){
count = 0;
for (let value of Object.values(websiteData)) {
count = count + 1;
if(value.url.includes(window.location.hostname.replace("app.",""))){
login = value.login;
password = value.password;
address = value.address;
break;
}
}
}
//Get the next Url from the website data map
async function getNextUrl(){
//Go to the beginning if the end of the array is reached
if(count >= websiteData.length){
websiteDataValues.nextUrl = websiteData[0].url;
}else{
websiteDataValues.nextUrl = websiteData[count].url;
}
//Ping Test to check if a website is up before proceeding to next url
// pingTest(websiteDataValues.nextUrl);
}
var isNextUrlReachable = false;
//Get the next Url from the website
function pingTest(websiteUrl) {
GM_xmlhttpRequest({
method: "GET",
url: websiteUrl,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
timeout: 5000,
onload: function(response) {
//Website is reachable
isNextUrlReachable = true;
},
onerror: function(e) {
count=count+1;
getNextUrl();
},
ontimeout: function() {
count=count+1;
getNextUrl();
},
});
}
async function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
var movingToNextUrl = false;
async function goToNextUrl() {
if(!movingToNextUrl){
movingToNextUrl = true;
getNextUrl();
while (!isNextUrlReachable) {
await delay(3000);
isNextUrlReachable = true;
}
console.log(websiteDataValues.nextUrl);
window.location.href = websiteDataValues.nextUrl;
}
}
async function goToWithdrawPage() {
if(!movingToNextUrl){
movingToNextUrl = true;
window.location.href = websiteDataValues.withdrawPageUrl;
}
}
//Default Setting: After 120 seconds go to next Url
var delayBeforeMovingToNextUrl = 90000;
if(websiteDataValues.timeoutbeforeMovingToNextUrl){
delayBeforeMovingToNextUrl = websiteDataValues.timeoutbeforeMovingToNextUrl;
}
setTimeout(function(){
goToNextUrl();
},delayBeforeMovingToNextUrl);
unsafeWindow.goToNextUrl = goToNextUrl;
function checkTimeoutMessageSelectors(){
if(websiteDataValues.timeoutMessageSelectors){
var checkTimeoutInterval = setInterval(function(){
for(let i=0; i< websiteDataValues.timeoutMessageSelectors.length; i++){
if(document.querySelector(websiteDataValues.timeoutMessageSelectors[i]) &&
document.querySelector(websiteDataValues.timeoutMessageSelectors[i]).innerText.length > 1) {
goToNextUrl();
clearInterval(checkTimeoutInterval);
break;
}
}
},5000);
}
}
//Returns true if message selectors are present
function messageSelectorsPresent(){
if(websiteDataValues.allMessageSelectors){
for(var j=0;j<websiteDataValues.allMessageSelectors.length;j++){
for(var k=0; k< document.querySelectorAll(websiteDataValues.allMessageSelectors[j]).length;k++){
if(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k] &&
(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].innerText.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl) ||
(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value &&
document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl)))){
return true;
}
}
}
}
return false;
}
//Returns true if message selectors are present
function successMessageSelectorsPresent(){
if(websiteDataValues.successMessageSelectors){
for(var j=0;j<websiteDataValues.successMessageSelectors.length;j++){
for(var k=0; k< document.querySelectorAll(websiteDataValues.successMessageSelectors[j]).length;k++){
if(document.querySelectorAll(websiteDataValues.successMessageSelectors[j])[k] && document.querySelectorAll(websiteDataValues.successMessageSelectors[j])[k].innerText.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl)){
return true;
}
}
}
}
return false;
}
function checkLoginSelectors(){
if(window.location.href.endsWith('/rewards') || window.location.href.endsWith('/rewards/')){
setTimeout(function(){
window.close();
},3000);
movingToNextUrl = true;
return;
}
if(websiteDataValues.loginSelectors){
//Check if all login selectors are present
let count =0;
for(let i=0; i< websiteDataValues.loginSelectors.length; i++){
if(document.querySelector(websiteDataValues.loginSelectors[i])){
count++;
}
}
if(count == 2 && count == websiteDataValues.loginSelectors.length){
if(address.length > 0 && !websiteDataValues.loginCaptcha){
document.querySelector(websiteDataValues.loginSelectors[0]).value = address;
triggerEvent(document.querySelector(websiteDataValues.loginSelectors[0]), 'input');
movingToNextUrl = true;
setTimeout(function(){
document.querySelector(websiteDataValues.loginSelectors[1])?.click();
},3000);
return;
}
}
if(count == 1 && count == websiteDataValues.loginSelectors.length){
if(address.length > 0 && websiteDataValues.loginCaptcha){
setTimeout(function(){
document.querySelector(websiteDataValues.loginSelectors[0]).value = address;
},3000)
return;
}
}
if(count == websiteDataValues.loginSelectors.length){
if(login.length > 0 && password.length > 0){
//Input Login
document.querySelector(websiteDataValues.loginSelectors[0]).value = login;
//Input Password
document.querySelector(websiteDataValues.loginSelectors[1]).value = password;
//Click Login Button (No Captcha before login button)
if(!websiteDataValues.loginCaptcha){
movingToNextUrl = true;
document.querySelector(websiteDataValues.loginSelectors[2])?.click();
}
}
}
}
}
//Special Usecase for Recaptcha Login
var callbackDefinedForRecaptcha = false;
for(let i=0; i< document.querySelectorAll(".g-recaptcha").length;i++){
if(document.querySelectorAll(".g-recaptcha")[i].getAttribute("data-callback")){
var currentCallback = document.querySelectorAll(".g-recaptcha")[i].getAttribute("data-callback");
let script_callback= document.createElement('script');
script_callback.type= 'text/javascript';
script_callback.innerText = 'var recaptcha_callback' + i + ' = function(response){currentCallback(response); document.querySelector(".g-recaptcha").setAttribute("value",response)}';
let body = document.getElementsByTagName('body')[0];
body.appendChild(script_callback);
document.querySelectorAll(".g-recaptcha")[i].setAttribute("data-callback","recaptcha_callback"+i);
}else{
if(!callbackDefinedForRecaptcha){
callbackDefinedForRecaptcha = true;
let script_callback= document.createElement('script');
script_callback.type= 'text/javascript';
script_callback.innerText = 'var recaptcha_callback = function(response){ document.querySelector(".g-recaptcha").setAttribute("value",response)}';
let body = document.getElementsByTagName('body')[0];
body.appendChild(script_callback);
}
document.querySelectorAll(".g-recaptcha")[i].setAttribute("data-callback","recaptcha_callback");
}
}
checkTimeoutMessageSelectors();
function usdFaucets(){
if(window.location.href.includes("dashboard")){
if(document.querySelector("a[href='faucet']")){
movingToNextUrl = true;
document.querySelector("a[href='faucet']").click();
}
}
}
async function checkPromo(){
if(window.location.href.includes("/promotion/")){
var promo = window.location.pathname.replaceAll("/promotion/","")
GM_setValue(window.location.hostname, promo);
var promoInterval = setInterval(function(){
if(grecaptcha && grecaptcha.getResponse().length > 0){
window.location.href="https://" + window.location.hostname;
clearInterval(promoInterval);
}
},5000);
// goToNextUrl();
}
console.log(GM_getValue(window.location.hostname))
if(document.querySelector("[placeholder='Promo code']")){
//Check if latest promo and existing promo are same
console.log("Checking Promo");
await getPromoCode();
if(!GM_getValue("lastPromoCode")){
return;
}
// PROMO_CODES[0]=GM_getValue("lastPromoCode");
if(!GM_getValue(window.location.hostname) || (GM_getValue(window.location.hostname) != GM_getValue("lastPromoCode"))){
// window.location.href = "https://" + window.location.hostname + "/promotion/" + PROMO_CODES[0];
window.location.href = "https://" + window.location.hostname + "/promotion/" + GM_getValue("lastPromoCode");
}else{
return;
}
var interval = setInterval(function(){
if(document.querySelector(".pending-rolls") && document.querySelector(".pending-rolls").innerText.includes("Rolls left")){
window.location.reload();
clearInterval(interval);
}
},5000)
}
}
setTimeout(function(){
checkPromo();
},5000);
setTimeout(function(){
if(!movingToNextUrl && websiteDataValues.beforeLoginButton){
for(let i=0;i<websiteDataValues.beforeLoginButton.length ;i++){
if(document.querySelector(websiteDataValues.beforeLoginButton[i])){
triggerEvent(document.querySelector(websiteDataValues.beforeLoginButton[i]), 'mousedown');
triggerEvent(document.querySelector(websiteDataValues.beforeLoginButton[i]), 'mouseup');
document.querySelector(websiteDataValues.beforeLoginButton[i]).click();
break;
}
}
}
checkLoginSelectors();
if(websiteDataValues.additionalFunctions){
websiteDataValues.additionalFunctions();
}
if(websiteDataValues.withdrawEnabled){
if(websiteDataValues.balanceSelector && document.querySelector(websiteDataValues.balanceSelector)){
var currentBalance = document.querySelector(websiteDataValues.balanceSelector).innerText;
if(currentBalance > websiteDataValues.withdrawMinAmount && !window.location.href.includes(websiteDataValues.withdrawPageUrl)) {
goToWithdrawPage();
}
}else{
if(successMessageSelectorsPresent()){
goToWithdrawPage();
}
}
}
//Look for all the default messages or errors before proceeding to next url
//For other languages difference in the length of the strings can be compared or visibility of the style element
if(!movingToNextUrl && messageSelectorsPresent()){
goToNextUrl();
}
//Check for all the default button selectors and click
//This will only click the first selector found, so mention the selectors with parent element wherever required
if(!movingToNextUrl && websiteDataValues.defaultButtonSelectors){
for(let i=0;i<websiteDataValues.defaultButtonSelectors.length ;i++){
if(document.querySelector(websiteDataValues.defaultButtonSelectors[i])){
console.log("Clicking button");
triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mousedown');
triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mouseup');
document.querySelector(websiteDataValues.defaultButtonSelectors[i])?.click();
break;
}
}
}
if(!movingToNextUrl && websiteDataValues.toggleCaptchaSelector && Number.isInteger(websiteDataValues.toggleCaptchaSelectorIndex)){
toggleCaptcha(websiteDataValues.toggleCaptchaSelector,websiteDataValues.toggleCaptchaSelectorIndex);
}
//Input the address and click the login button
if(!movingToNextUrl && document.querySelector(websiteDataValues.inputTextSelector)){
document.querySelector(websiteDataValues.inputTextSelector).value = websiteDataValues.address;
setTimeout(function(){
if(websiteDataValues.inputTextSelectorButton && document.querySelector(websiteDataValues.inputTextSelectorButton)){
document.querySelector(websiteDataValues.inputTextSelectorButton).click();
}
},5000);
}
//Click the form button after solving captcha
//Works for both recaptcha and hcaptcha
var clicked = false;
var captchaInterval = setInterval(function(){
try{
if(!clicked && grecaptcha && grecaptcha.getResponse().length > 0 || document.querySelector(".g-recaptcha").getAttribute("value").length > 0){
if(websiteDataValues.captchaButtonSubmitSelectors){
for(let i=0;i< websiteDataValues.captchaButtonSubmitSelectors.length;i++){
if(document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i])){
document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i]).click();
}
}
}
clicked = true;
clearInterval(captchaInterval);
setTimeout(function(){
// if(messageSelectorsPresent()){
goToNextUrl();
// }
},10000);
}
}catch(e){
}
for(var hc=0; hc < document.querySelectorAll("iframe").length; hc++){
if(! clicked && document.querySelectorAll("iframe")[hc] &&
document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response") &&
document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response").length > 0) {
if(websiteDataValues.captchaButtonSubmitSelectors){
for(let i=0;i< websiteDataValues.captchaButtonSubmitSelectors.length;i++){
if(document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i])){
document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i]).click();
}
}
}
clicked = true;
clearInterval(captchaInterval);
setTimeout(function(){
if(messageSelectorsPresent()){
goToNextUrl();
}
},10000);
}
}
},5000);
},10000);
})();