Auto Click Cloudflare

Cloudflare

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Auto Click Cloudflare
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Cloudflare
// @author       pcayb96
// @match        *://*/*
// @grant        none
// @run-at       document-start

// ==/UserScript==

(function() {
    'use strict';

    function clickIgnoreButton() {
        // ???? ?????? ?? ?????? ????????? ??????????
        const ignoreButtonSelectors = [
            'button:contains("Ignore & Proceed")',
            'a:contains("Ignore & Proceed")',
            'button.ignore-button',
            'a.ignore-button',
            'button[class*="ignore"]',
            'a[class*="ignore"]',
            '[onclick*="ignore"]',
            '[id*="ignore"]',
            '[class*="proceed"]'
        ];

        // ?????????? ????????? ? ???????? ????? ? ?????? ?? ??????
        for (const selector of ignoreButtonSelectors) {
            try {
                // ????? ?? ?????? ???????????
                const buttonsByText = Array.from(document.querySelectorAll('button, a, input[type="button"], input[type="submit"]'))
                    .filter(el => el.textContent && el.textContent.includes('Ignore') && el.textContent.includes('Proceed'));

                if (buttonsByText.length > 0) {
                    buttonsByText[0].click();
                    console.log('Clicked ignore button by text content');
                    return true;
                }

                // ????? ?? ?????????
                const buttons = document.querySelectorAll(selector);
                if (buttons.length > 0) {
                    buttons[0].click();
                    console.log('Clicked ignore button by selector: ' + selector);
                    return true;
                }
            } catch (e) {
                // ?????????? ?????? ??????????
            }
        }

        return false;
    }

    // ???????, ??????? ????? ?????????? ????????? ??? ??? ??????? ??????? ?? ??????
    function attemptToClick() {
        if (clickIgnoreButton()) {
            console.log('Successfully clicked the ignore button');
        } else {
            console.log('Button not found yet');
        }
    }

    // ????????? ??????? ????? ??? ????? ?????? ? ?????
    // ???????? ? ??????????? ???????? ? ??????????? ????????
    for (let i = 0; i < 5; i++) {
        setTimeout(attemptToClick, 50 * i); // ?????? ??????? - ????? ?????? (50, 100, 150, 200, 250 ??)
    }

    for (let i = 0; i < 10; i++) {
        setTimeout(attemptToClick, 300 + 100 * i); // ????????? ??????? ? ?????????? ? 100 ??
    }

    // ????????? ??? ???????? DOM ??? ??????????
    document.addEventListener('DOMContentLoaded', function() {
        attemptToClick();
        // ??? ????????? ??????? ????? ???????? DOM
        setTimeout(attemptToClick, 50);
        setTimeout(attemptToClick, 100);
        setTimeout(attemptToClick, 200);
    });

    // ????????? MutationObserver ??? ???????????? ????????? ?????? ? ??????????? ??????????? ????????
    function setupObserver() {
        if (!document.body) return;

        const observer = new MutationObserver(function(mutations) {
            for (const mutation of mutations) {
                if (mutation.addedNodes && mutation.addedNodes.length > 0) {
                    // ???? ???? ????????? ????? ????, ??????? ?????? ?? ??????
                    attemptToClick();
                }
            }
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    // ????????? ??????????? ??? ????? ??????
    if (document.body) setupObserver();
    else document.addEventListener('DOMContentLoaded', setupObserver);
})();