Greasy Fork

Mathletics Auto Math Solver

Automatically solves Mathletics math problems when "A" is pressed.

目前为 2024-11-23 提交的版本。查看 最新版本

// ==UserScript==
// @name         Mathletics Auto Math Solver 
// @namespace    / http://tampermonkey.net
// @version      1.0
// @description  Automatically solves Mathletics math problems when "A" is pressed.
// @author       nukerboss
// @match        https://*.mathletics.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
})();

!function() {
    "use strict";
    var e, s, t = 0, a = new WebSocket("ws://localhost:8080"), n = 0, c = !0;

    function i(e) {
        n = 0, t = 0, $(".questions-text-alignment").change(function() {
            (t < e - 1 || -1 == e) && setTimeout(function() {
                r()
            }, 0), t++
        }), r()
    }

    function r() {
        var s = document.getElementsByClassName("questions-text-alignment")[0].innerText.trim(),
            t = s.split(" ");
        
        // Handle equations like "7 + _ = 20"
        if (s.includes("=")) {
            // If it contains a "_", we need to solve for that blank
            if (s.includes("_")) {
                // Find the operator
                if (s.includes("+")) {
                    var parts = s.split("+");
                    var left = parseInt(parts[0].trim());
                    var right = parseInt(parts[1].split("=")[0].trim());
                    var result = right - left;
                } else if (s.includes("-")) {
                    var parts = s.split("-");
                    var left = parseInt(parts[0].trim());
                    var right = parseInt(parts[1].split("=")[0].trim());
                    var result = left - right;
                } else if (s.includes("×")) {
                    var parts = s.split("×");
                    var left = parseInt(parts[0].trim());
                    var right = parseInt(parts[1].split("=")[0].trim());
                    var result = right / left;
                }
                document.getElementById("dashow").innerText = result;
                document.getElementsByClassName("questions-input-adjustment questions-input-width-v3")["0"].value = result;
            } else {
                // Standard equation, solve based on operator
                switch (t.length) {
                    case 4:
                        var m;
                        switch (e = t[1]) {
                            case "+":
                                m = parseInt(t[0]) + parseInt(t[2]);
                                break;
                            case "-":
                                m = parseInt(t[0]) - parseInt(t[2]);
                                break;
                            case "×":
                                m = parseInt(t[0]) * parseInt(t[2]);
                                break;
                            case "÷":
                                m = parseInt(t[0]) / parseInt(t[2]);
                                break;
                        }
                        break;
                    case 5:
                        t[4] = t[4].substring(0, t[4].length - 1), m = parseInt(t[0]) + parseInt(t[2]) + parseInt(t[4]);
                        break;
                    case 6:
                        m = parseInt(t[0]) + parseInt(t[2]) + parseInt(t[4]);
                }
            }
        } else {
            // If it's just a simple expression, handle it here
            var b = [];
            switch (e = t[1], t.forEach(function(e) {
                isNaN(e) || "" == e || b.push(e)
            }), e) {
                case "+":
                    m = b[1] - b[0];
                    break;
                case "×":
                    m = b[1] / b[0];
            }
        }

        // Send the result back to the server or apply it
        isNaN(m) ? n < 2 && !c && (n++, o(0)) : o(m)
    }

    function o(e) {
        a.send(e)
    }

    document.onkeydown = function(e) {
        switch (e.keyCode) {
            case 37:
                i(150);
                break;
            case 38:
                r();
                break;
            case 39:
                i(-1);
                break;
            case 40:
                c = (t = [400, 500])[0], o = t[1], s = !0, n = 0, setTimeout(function() {
                    s = !1
                }, 6e4), function e() {
                    s && (a = Math.round(Math.random() * (o - c)) + c, setTimeout(function() {
                        r(), e()
                    }, a))
                }()
        }
    };
}();

console.inspect
var time = 60;
var clock = 300;

function TimeHack() {
    setInterval(function Applytime() {
        document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerText = time;
        document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerHtml = time;
        document.getElementsByClassName('clockHand').rotate = clock;
    }, 1);
};

function TimeHackm() {
    setInterval(function Addtime() {
        time = time + 1;
        clock = clock + 6;
    }, 1000);
}

var score = 1;

function ScoreHack() {
    setInterval(function ApplyScore() {
        score = score + 1
        document.getElementById("scoreBar0").innerText = score;
    }, 1);
};

alert("This hack was made by Andromeda on Greasyfork / Tampermonkey, Discord: andromeda#3410")

var btn = document.createElement("BUTTON");
document.body.appendChild(btn);
btn.setAttribute("onclick", "ShowAwnser()");
btn.setAttribute("id", "dashow")
var t = document.createTextNode("A Spam Bot");
btn.appendChild(t);

var btnt = document.createElement("BUTTON");
document.body.appendChild(btnt);
btnt.setAttribute("onclick", "TimeHack(); TimeHackm()")
btnt.setAttribute("id", "dasho")
var tt = document.createTextNode("Time Cheat");
btnt.appendChild(tt);

var btnd = document.createElement("BUTTON");
document.body.appendChild(btnd);
btnd.setAttribute("onclick", "ScoreHack()");
btnd.setAttribute("id", "dashowd")
var td = document.createTextNode("Find Points");
btnd.appendChild(td);

function ShowAwnser() {
    var nums = document.getElementsByClassName('questions-text-alignment whiteTextWithShadow question-size-v4')["0"].innerText;
    var add = nums.split('+' && '=');
    var equasion = add[0];

    function addbits(s) {
        var total = 0, s = s.match(/[+\-]*(\.\d+|\d+(\.\d+)?)/g) || [];
        while (s.length) {
            total += parseFloat(s.shift());
        }
        return total;
    }

    var awnser = addbits(equasion)

    document.getElementById('dashow').innerText = awnser;
    document.getElementsByClassName("questions-input-adjustment questions-input-width-v3")["0"].value = awnser;
}

window.addEventListener("keydown", checkKeyPressed, false);

function checkKeyPressed(e) {
    if (e.keyCode == "65") {
        ShowAwnser()
    }
}