Skip to content

Instantly share code, notes, and snippets.

@bernaction
Last active August 31, 2024 00:41
Show Gist options
  • Select an option

  • Save bernaction/310c982c0da52d0d7c67607d50eff6e1 to your computer and use it in GitHub Desktop.

Select an option

Save bernaction/310c982c0da52d0d7c67607d50eff6e1 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Autoclaim Faucet Xeggex
// @version 0.2
// @match https://xeggex.com/faucet*
// @author BernaCripto.com.br
// @grant none
// @description Auto clicker faucet button on xeggex.com
// ==/UserScript==
(function () {
'use strict';
const claimButtonSelector = 'button.btn.btn-sm.makeclaim';
const errorButtonSelector = 'button.swal-button.swal-button--confirm';
const logInLinkSelector = 'a[href="/login"].d-none.d-sm-block';
let checkInterval;
// Função para enviar notificações
function sendNotification(title, message) {
if (Notification.permission === 'granted') {
new Notification(title, { body: message });
}
}
// Função para verificar se o usuário está deslogado
function checkLoggedOut() {
const logInLink = document.querySelector(logInLinkSelector);
if (logInLink) {
sendNotification('Deslogado', 'Você foi deslogado do site.');
clearInterval(checkInterval);
observer.disconnect(); // Parar o observer
}
}
// Função para clicar nos botões de claim e erro
function clickButtons() {
const claimButton = document.querySelector(claimButtonSelector);
const errorButton = document.querySelector(errorButtonSelector);
if (claimButton) {
claimButton.click();
}
if (errorButton) {
errorButton.click();
location.reload();
}
}
// Atrasar a execução do observer para evitar detecção
setTimeout(() => {
// Observer para mudanças na página
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length || mutation.removedNodes.length) {
clickButtons();
checkLoggedOut();
}
});
});
// Configura o observer para monitorar mudanças no corpo da página
observer.observe(document.body, { childList: true, subtree: true });
// Verificar se o usuário está deslogado a cada 10 segundos
checkInterval = setInterval(checkLoggedOut, 10000); // 10 segundos
}, 5000); // Atraso de 5 segundos antes de começar o script
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment