marcar todos

Automatically select a specific radio button on the ASI Web page

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         marcar todos
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically select a specific radio button on the ASI Web page
// @author       ils94
// @match        https://asiweb.tre-rn.jus.br/asi/web?target=com.linkdata.patrimonio.bem.web.ConsultaGeralGateway&action=start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let outerInterval;

    // Function to select the radio button
    function selectRadioButton() {
        console.log('Attempting to find the radio button...');

        var xpath = "/html/body/div[2]/div[3]/form/div[1]/div[2]/div[2]/fieldset/ul/li/span/span[4]/input";
        var radioButton = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

        if (radioButton) {
            console.log('Radio button found. Starting action loop...');
            var actionInterval = setInterval(function() {
                radioButton.checked = true;
                console.log('Radio button checked.');
                if (radioButton.checked) {
                    clearInterval(actionInterval);
                    clearInterval(outerInterval);
                    console.log('Radio button successfully checked.');
                }
            }, 500);
        } else {
            console.log('Radio button not found. Retrying...');
        }
    }

    // Start the initial loop
    outerInterval = setInterval(selectRadioButton, 500);

})();