Auto-Click Button Script

Automatically click the button when the timer is below 7 seconds.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Auto-Click Button Script
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automatically click the button when the timer is below 7 seconds.
// @author       Sark
// @match        https://msg.cityline.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to simulate a click
    function clickButton() {
        const button = document.getElementById('btn-retry-en-1');
        if (!button.disabled) {
            button.click();
        }
    }

    // Monitor changes to the 'remainTime1' element
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                const remainTimeText = mutation.addedNodes[0].textContent;
                const timeValue = parseInt(remainTimeText.replace(/[^\d]/g, ''), 10);
                if (timeValue < 7) {
                    clickButton();
                }
            }
        });
    });

    // Start observing
    const targetNode = document.getElementById('remainTime1');
    if (targetNode) {
        observer.observe(targetNode, { childList: true });
    }
})();