Mathspace Auto Solver (Debug Version)

Fetches and displays correct answers in Mathspace (Debugging Enabled)

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Mathspace Auto Solver (Debug Version)
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Fetches and displays correct answers in Mathspace (Debugging Enabled)
// @author       You
// @match        *://*.mathspace.co/*
// @grant        none
// ==/UserScript==

var MathspaceSolver = {};

MathspaceSolver.getAnswers = function() {
    console.log("MathspaceSolver: Searching for questions...");

    // Observe the page for questions
    Sahin.observeElements("div, span, p", function(elements) {
        elements.forEach(element => {
            let text = element.innerText.trim();
            if (!text) return;

            console.log("Found Potential Question:", text);

            // Simulated fetching answer
            MathspaceSolver.fetchAnswer(text, function(answer) {
                if (answer) {
                    MathspaceSolver.displayAnswer(element, answer);
                }
            });
        });
    });
};

MathspaceSolver.fetchAnswer = function(question, callback) {
    let fakeAnswer = "42"; // Placeholder answer
    console.log(`Fetching answer for: "${question}" → ${fakeAnswer}`);
    callback(fakeAnswer);
};

MathspaceSolver.displayAnswer = function(element, answer) {
    if (element.querySelector(".mathspace-answer-box")) return;

    let answerBox = document.createElement("div");
    answerBox.className = "mathspace-answer-box";
    answerBox.style.background = "#fffa65";
    answerBox.style.border = "2px solid #f39c12";
    answerBox.style.padding = "10px";
    answerBox.style.marginTop = "10px";
    answerBox.style.fontSize = "18px";
    answerBox.style.fontWeight = "bold";
    answerBox.style.color = "#333";
    answerBox.innerText = `Answer: ${answer}`;

    element.appendChild(answerBox);
    console.log("Displayed Answer:", answer);
};

// Start script
MathspaceSolver.getAnswers();

Sahin.injectFunctionsToPage(MathspaceSolver);