Auto click Claim Button

自動點擊所有帶有 "Claim" 字眼的按鈕,直到按鈕可用為止,並等待 CAPTCHA 解決。

Από την 08/12/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Auto click Claim Button
// @namespace    AutoClickClaimButton
// @version      1.1
// @description  自動點擊所有帶有 "Claim" 字眼的按鈕,直到按鈕可用為止,並等待 CAPTCHA 解決。
// @author       Yueei
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // 檢查 CAPTCHA 是否存在
    function checkCaptcha() {
        const captchaSelectors = [
            "iframe[src*='recaptcha']",
            ".g-recaptcha",
            ".h-captcha",
            ".turnstile",
            "[data-sitekey]"
        ];

        const captchaExists = captchaSelectors.some(selector => document.querySelector(selector));

        if (captchaExists) {
            console.log('檢測到 CAPTCHA,等待解決...');
            return true; // 若發現 CAPTCHA,返回 true 表示有 CAPTCHA
        }

        return false; // 若無 CAPTCHA,返回 false 允許繼續執行按鈕點擊
    }

    // 自動點擊 Claim 按鈕的函數
    function clickClaimButton() {
        const buttons = Array.from(document.querySelectorAll("button, a"));
        const claimButton = buttons.find(btn =>
            btn.textContent.trim().toLowerCase().includes('claim') && // 包含 "claim"
            !btn.disabled // 按鈕未禁用
        );

        if (claimButton) {
            claimButton.click();
            console.log(`已成功點擊 Claim 按鈕: ${claimButton.textContent.trim()}`);
        } else {
            console.log('尚未找到可用的 Claim 按鈕,等待...');
        }
    }

    // 主函數,定期執行檢查
    function startProcess() {
        console.log('自動點擊腳本已啟動,正在監控 Claim 按鈕...');
        setInterval(() => {
            if (!checkCaptcha()) { // 如果沒有 CAPTCHA,嘗試點擊 Claim 按鈕
                clickClaimButton();
            }
        }, 10000); // 每 10 秒執行一次檢查
    }

    // 啟動腳本
    startProcess();
})();