Auto-Click Button Script

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==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 });
    }
})();