TTRS Auto Answer Simulator (Internal Testing)

Auto answers questions on TTRS for authorized testing only

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         TTRS Auto Answer Simulator (Internal Testing)
// @namespace    https://ttrockstars.com/
// @version      1.1
// @description  Auto answers questions on TTRS for authorized testing only
// @author       TTRS Security Team
// @license      MIT
// @match        *://*.ttrockstars.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function getAnswer(question) {
        // TTRS questions look like "6 x 7" or "12 x 3"
        const parts = question.split('x');
        if (parts.length !== 2) return '';
        const num1 = parseInt(parts[0].trim());
        const num2 = parseInt(parts[1].trim());
        return num1 * num2;
    }

    function simulateAutoAnswer() {
        // Actual question element - this is a div with class "question__content" or similar
        const questionEl = document.querySelector('.question__content, .question-text, .question');
        // The input where you type the answer
        const inputEl = document.querySelector('input.answer-input, input[type="text"], input[aria-label="Answer"]');
        // The submit button
        const submitBtn = document.querySelector('button.submit-btn, button[type="submit"], button[aria-label="Submit"]');

        if (questionEl && inputEl && submitBtn) {
            const questionText = questionEl.innerText || questionEl.textContent;
            const answer = getAnswer(questionText);
            if (!isNaN(answer)) {
                // Only answer if input is empty or different
                if (inputEl.value !== String(answer)) {
                    inputEl.value = answer;
                    // Trigger input event so React/Vue/Angular registers the change
                    inputEl.dispatchEvent(new Event('input', { bubbles: true }));
                    submitBtn.click();
                    console.log(`[AutoAnswer] Question: "${questionText.trim()}" Answered: ${answer}`);
                }
            }
        } else {
            // If one or more elements are missing, log for debugging
            console.log('[AutoAnswer] Waiting for question, input, or submit button elements...');
        }

        setTimeout(simulateAutoAnswer, 200);
    }

    setTimeout(simulateAutoAnswer, 1000);
})();