Thành viên:Plantaest/autoclickJWB.js

Bách khoa toàn thư mở Wikipedia

Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet ExplorerSafari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.

javascript: (function() {
    var imported = document.createElement('script');
    imported.src = 'https://cdn.jsdelivr.net/npm/@alorel-github-mirrors/hacktimer@1.1.0/HackTimer.js';
    document.head.appendChild(imported);

    function createInput() {
        var $input = $('<input type="button" id="autoClick" class="editbutton" value="Auto"/>');
        $("#skipButton").before($input);
    }
    
    createInput();
    
    var temp = window.alert;
    var interval;

    function start() {
        window.alert = function() {};
        interval = setInterval(autoclick, 250);
    }
    
    $("#autoClick").click(function() {
        start();
    });

    function autoclick() {
        if ($("#totPages").text() == "0" || $('#stopbutton').attr("disabled")) {
            clearInterval(interval);
            $("#startbutton").attr("disabled", true);
            $(document).ready(function($) {
                setTimeout(function() {
                    window.alert = temp;
                    $("#startbutton").prop("disabled", false);
                }, 5000);
            });
        }
        
        if (!$("#startbutton").attr("disabled")) {
            clearInterval(interval);
            $('#startbutton').click();
            start();
        }
        
        if ($('#resultWindow').has('h2').length) {
            if (!$('#skipButton').attr("disabled")) {
                $('#skipButton').click();
            }
        } else {
            if (!$('#submitButton').attr("disabled")) {
                $('#submitButton').click();
            }
        }
    }
})();