LinksFly Auto Faucet

Automatically login and claim faucets on LinksFly.

当前为 2024-12-28 提交的版本,查看 最新版本

// ==UserScript==
// @name         LinksFly Auto Faucet
// @namespace    https://example.com/
// @version      1.5
// @description  Automatically login and claim faucets on LinksFly.
// @author       Knoji
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_addStyle
// @grant        GM_registerMenuCommand
// @require      https://gf.qytechs.cn/scripts/439099-monkeyconfig-modern-reloaded/code/MonkeyConfig%20Modern%20Reloaded.js
// @match        *://linksfly.link/*
// @license      MIT
// ==/UserScript==

const cfg = new MonkeyConfig({
    title: 'Input Email Faucetpay:',
    menuCommand: true,
    params: {
        Email: {
            label: "Email Faucetpay",
            type: "text",
            default: ''
        },
    }
});

(function () {
    'use strict';

    window.addEventListener('load', () => {
        const email = cfg.get('Email').trim();

        if (!email) {
            enforceLogoutWithWarning();
        } else {
            enforceReferralUrl();
            setTimeout(() => clickLoginModal(), 1000);
            const modalCheckInterval = setInterval(() => {
                const loginModal = document.querySelector('#login');
                if (loginModal && loginModal.classList.contains('show')) {
                    clearInterval(modalCheckInterval);
                    clickLoginModal();
                }
            }, 500);

            setTimeout(() => {
                if (document.querySelector("#logoutModal")) {
                    rotateUrls();
                    initiateClaimProcess();
                    waitAndClick('Go Claim', 500, 30);
                }
            }, 500);
        }
    });

    function enforceReferralUrl() {
        const loggedIn = document.querySelector("#logoutModal");
        if (loggedIn) return;

        if (window.location.href === "https://linksfly.link/") {
            window.location.replace("https://linksfly.link/");
        }
    }

    function enforceLogoutWithWarning() {
        const loggedIn = document.querySelector("#logoutModal");
        if (loggedIn) {
            alert('Please enter your email in the settings menu before using this script.');
            const logoutButton = document.querySelector('a[href="https://linksfly.link//auth/logout"]');
            if (logoutButton) {
                logoutButton.click();
            } else {
                window.location.replace("https://linksfly.link//auth/logout");
            }
        }
    }

    function clickLoginModal() {
        const loginModal = document.querySelector('#login');
        if (loginModal) {
            if (!loginModal.classList.contains('show')) {
                loginModal.classList.add('show');
                loginModal.style.display = 'block';
                loginModal.setAttribute('aria-hidden', 'false');
                document.body.classList.add('modal-open');
            }

            const emailInput = document.querySelector('#InputEmail');
            if (emailInput) {
                emailInput.value = cfg.get('Email').trim();
            }

            const loginButton = loginModal.querySelector('button[type="submit"]');
            if (loginButton) loginButton.click();
        }
    }

    const urls = [
        "https://linksfly.link//faucet/currency/ltc",
        "https://linksfly.link//faucet/currency/doge",
        "https://linksfly.link//faucet/currency/usdt",
        "https://linksfly.link//faucet/currency/sol",
        "https://linksfly.link//faucet/currency/trx",
        "https://linksfly.link//faucet/currency/bnb",
        "https://linksfly.link//faucet/currency/bch",
        "https://linksfly.link//faucet/currency/dash",
        "https://linksfly.link//faucet/currency/dgb",
        "https://linksfly.link//faucet/currency/eth",
        "https://linksfly.link//faucet/currency/fey",
        "https://linksfly.link//faucet/currency/zec",
        "https://linksfly.link//faucet/currency/matic",
        "https://linksfly.link//faucet/currency/xmr"
    ];

    let currentIndex = parseInt(localStorage.getItem('currentIndex')) || 0;
    const rotateUrls = () => {
        if (window.location.href === "https://linksfly.link//") {
            window.location.href = urls[currentIndex];
            currentIndex = (currentIndex + 1) % urls.length;
            localStorage.setItem('currentIndex', currentIndex);
        }
    };

    function initiateClaimProcess() {
        const interval = setInterval(() => {
            const inputField = document.querySelector('.form-control.mb-3');
            const captchaContainer = document.querySelector('.cf-turnstile');
            const claimButton = document.querySelector('#subutt');

            if (claimButton) {
                scrollToButton(claimButton);
            }

            if (inputField && inputField.value.trim() !== "" && captchaContainer) {
                const turnstileCompleted = captchaContainer.querySelector('[name="cf-turnstile-response"]');
                if (turnstileCompleted && turnstileCompleted.value.trim() !== "") {
                    setTimeout(() => {
                        if (!claimButton.disabled) {
                            claimButton.click();
                            clearInterval(interval);
                        }
                    }, 500);
                }
            }
        }, 2000);

        setTimeout(() => {
            clearInterval(interval);
        }, 30000);
    }

    function scrollToButton(button) {
        const rect = button.getBoundingClientRect();
        const offset = rect.top + window.scrollY - (window.innerHeight - rect.height);
        window.scrollTo({
            top: offset,
            behavior: "smooth"
        });
    }

    function waitAndClick(buttonText, interval = 500, maxAttempts = 20) {
        let attempts = 0;
        const timer = setInterval(() => {
            attempts++;
            if (clickByText(buttonText) || attempts >= maxAttempts) {
                clearInterval(timer);
            }
        }, interval);
    }

    function clickByText(buttonText) {
        const buttons = document.querySelectorAll('a.btn');
        for (const button of buttons) {
            if (button.textContent.trim() === buttonText) {
                button.click();
                return true;
            }
        }
        return false;
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址