Century Tech Auto Answer

Auto answer questions on Century Tech

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Century Tech Auto Answer
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Auto answer questions on Century Tech
// @author       You
// @match        https://app.century.tech/*
// @grant        none
// @license      MIT; https://opensource.org/licenses/MIT
// ==/UserScript==

(function() {
    'use strict';
    
    // Function to auto-answer questions
    function autoAnswer() {
        var questions = document.querySelectorAll('.question');
        
        questions.forEach(function(question) {
            // Try to find the correct answer
            var correctAnswer = question.querySelector('.correct-answer');
            if (correctAnswer) {
                // If a correct answer is found, select it
                var answerInput = correctAnswer.previousElementSibling; // Assuming the input is before the label
                if (answerInput && answerInput.type === 'radio') {
                    answerInput.checked = true;
                    answerInput.labels[0].click(); // Simulate the click on the label
                }
            } else {
                // If no correct answer is found, select the first available answer
                var firstAnswerInput = question.querySelector('input[type="radio"]');
                if (firstAnswerInput) {
                    firstAnswerInput.checked = true;
                    firstAnswerInput.labels[0].click(); // Simulate the click on the label
                }
            }
        });

        // Submit answers
        var submitButton = document.querySelector('.submit-button');
        if (submitButton) {
            submitButton.click();
        }
    }

    // Run the auto-answer function
    autoAnswer();
})();