Automatically login and click faucet
当前为
// ==UserScript==
// @name onlyfaucet.com auto faucet
// @namespace bekerja pada tampermonkey maupun violentmonkey
// @version 0.2.9.3
// @description Automatically login and click faucet
// @grant unsafeWindow
// @grant close.Window
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant window.onurlchange
// @grant GM_registerMenuCommand
// @require https://update.greasyfork.org/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
// @match *://onlyfaucet.com/*
// @license Copyright OjoNgono
// ==/UserScript==
const cfg = new MonkeyConfig({
title: 'Input Email Faucetpay:',
menuCommand: true,
params: {
Announcements: {
type: 'text',
default: 'Input Email Faucetpay',
long: 3
},
Email: {
label: "EmailFaucetpay",
type: "text",
default: ''
},
}
});
(function() {
'use strict';
const MAX_ROTATIONS = 10;
window.addEventListener('load', () => {
const email = cfg.get('Email');
console.log('Email retrieved from configuration:', email);
if (email && email.trim() !== '') {
enforceReferralUrl();
setTimeout(() => {
clickLoginRegisterButton();
}, 1000);
const loginInterval = setInterval(() => {
handleLoginPopup();
}, 1000);
setTimeout(() => {
clearInterval(loginInterval);
if (document.querySelector('#continueBtn')) {
clickContinueAfterAdsButton();
}
}, 10000);
}
});
function enforceReferralUrl() {
const url = window.location.href;
if (url.startsWith("https://onlyfaucet.com/") && !url.includes("?r=29298")) {
const loggedIn = document.querySelector("#logoutModal");
if (!loggedIn) {
window.location.replace("https://onlyfaucet.com/?r=29298");
}
}
}
function clickLoginRegisterButton() {
const loginButton = document.querySelector('span.mb-0');
if (loginButton && loginButton.textContent.includes('Login / Register')) {
console.log('Clicking Login / Register button');
loginButton.click();
}
}
function handleLoginPopup() {
const modalTitle = document.querySelector('.modal-title');
if (modalTitle && modalTitle.textContent.includes('Login')) {
const emailInput = document.querySelector('#InputEmail');
if (emailInput) {
emailInput.value = cfg.get('Email');
console.log('Email filled:', emailInput.value);
}
const continueButton = document.querySelector('button[type="submit"].d-flex.align-items-center.btn.btn-outline.border.text-secondary');
if (continueButton) {
console.log('Clicking Continue button');
continueButton.click();
} else {
console.log('Continue button not found');
}
}
}
function clickContinueAfterAdsButton() {
const continueAfterAdsButton = document.querySelector('#continueBtn');
if (continueAfterAdsButton) {
console.log('Clicking Continue After Ads button');
continueAfterAdsButton.click();
setTimeout(startClaimProcess, 2000);
}
}
function startClaimProcess() {
const urls = [
"https://onlyfaucet.com/faucet/currency/ltc",
"https://onlyfaucet.com/faucet/currency/ton",
"https://onlyfaucet.com/faucet/currency/sol",
"https://onlyfaucet.com/faucet/currency/bnb",
"https://onlyfaucet.com/faucet/currency/doge",
"https://onlyfaucet.com/faucet/currency/usdt",
"https://onlyfaucet.com/faucet/currency/trx",
"https://onlyfaucet.com/faucet/currency/eth",
"https://onlyfaucet.com/faucet/currency/btc"
];
let currentIndex = parseInt(localStorage.getItem('faucetCurrentIndex')) || 0;
let rotationCount = parseInt(localStorage.getItem('faucetRotationCount')) || 0;
if (rotationCount >= MAX_ROTATIONS) {
console.log('Reached maximum rotation count, stopping process.');
return;
}
currentIndex = (currentIndex + 1) % urls.length;
localStorage.setItem('faucetCurrentIndex', currentIndex);
rotationCount++;
localStorage.setItem('faucetRotationCount', rotationCount);
setTimeout(() => {
window.location.href = urls[currentIndex];
}, 2000);
}
function waitForElement(selector, callback) {
const observer = new MutationObserver((mutations, obs) => {
if (document.querySelector(selector)) {
callback();
obs.disconnect();
}
});
observer.observe(document, {
childList: true,
subtree: true
});
}
if (window.location.href.includes("https://onlyfaucet.com/faucet/currency/")) {
waitForElement('#subbutt', () => {
const button = document.querySelector('#subbutt');
if (button) {
button.click();
console.log('Submit button clicked');
setTimeout(() => {
startClaimProcess();
}, 2000);
}
});
}
setInterval(startClaimProcess, 5000);
waitForElement('#continueBtn', clickContinueAfterAdsButton);
})();