Mathswatch AutoSolver

Automatically fills and submits answers for Mathswatch questions using pre-stored answers (client-side 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         Mathswatch AutoSolver
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Automatically fills and submits answers for Mathswatch questions using pre-stored answers (client-side only)
// @author       Anonymous
// @match        https://*.mathswatch.co.uk/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // ===========================
    // === Precomputed Answers ===
    // ===========================
    // Add questions exactly as they appear on Mathswatch.
    const answers = {
        "1+1": "2",
        "2*2": "4",
        "5-3": "2"
        // Add more questions here
    };

    // ===========================
    // === Main Function ===
    // ===========================
    function autoFillAndSubmit() {
        // Detect the input field for the answer
        const inputField = document.querySelector('input[type="text"]');
        if (!inputField) return;

        // Detect the question text element
        const questionElement = document.querySelector('.question, .question-text');
        if (!questionElement) return;

        const questionText = questionElement.innerText.trim();

        // Fill in the answer if available
        if (answers[questionText]) {
            if (inputField.value !== answers[questionText]) {
                inputField.value = answers[questionText];
                console.log(`[AutoSolver] Filled answer for: "${questionText}"`);

                // Attempt to auto-submit
                const submitButton = document.querySelector('button[type="submit"], .submit-button');
                if (submitButton) {
                    submitButton.click();
                    console.log(`[AutoSolver] Submitted answer for: "${questionText}"`);
                }
            }
        }
    }

    // ===========================
    // === Continuous Monitoring ===
    // ===========================
    // Check every 500ms for new questions
    setInterval(autoFillAndSubmit, 500);

})();