Intercepts MathsOnline answers with a draggable, togglable HUD
// ==UserScript==
// @name MathsOnline HACKS!! {CHEAT} {HACKS} {EXPLOIT} {API} {DECOMPILED}
// @namespace http://tampermonkey.net/
// @version 1.9
// @description Intercepts MathsOnline answers with a draggable, togglable HUD
// @author Phil 🥹👍 and DynaHacks
// @license MIT
// @match *://*.mathsonline.com.au/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
let hudContainer = null;
let hudContent = null;
let isHidden = false;
const styles = `
#hacks-hud {
position: fixed;
top: 20px;
right: 20px;
width: 280px;
background: rgba(20, 20, 20, 0.95);
color: #ffffff;
border: 1px solid #00ff00;
border-radius: 8px;
font-family: monospace;
box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
z-index: 999999;
transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
user-select: none;
}
#hacks-hud-header {
background: #111;
padding: 10px 12px;
font-weight: bold;
font-size: 12px;
border-bottom: 1px solid #333;
display: flex;
justify-content: space-between;
align-items: center;
cursor: grab;
}
#hacks-hud-header:active {
cursor: grabbing;
}
#hacks-hud-title {
color: #00ff00;
}
#hacks-hud-toggle-btn {
background: #333;
border: 1px solid #555;
color: #aaa;
padding: 2px 6px;
border-radius: 3px;
cursor: pointer;
font-size: 10px;
}
#hacks-hud-toggle-btn:hover {
background: #444;
color: #fff;
}
#hacks-hud-body {
padding: 12px;
max-height: 300px;
overflow-y: auto;
font-size: 11px;
}
.hacks-answer-row {
display: flex;
justify-content: space-between;
padding: 6px 0;
border-bottom: 1px solid #222;
}
.hacks-answer-row:last-child {
border-bottom: none;
}
.hacks-label {
color: #888;
}
.hacks-val {
color: #00ff00;
font-weight: bold;
}
.hacks-hidden-hud {
opacity: 0 !important;
pointer-events: none !important;
transform: scale(0.95) translateY(-10px);
}
`;
function injectStyles() {
const styleSheet = document.createElement("style");
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
}
function createHUD() {
if (document.getElementById('hacks-hud')) return;
hudContainer = document.createElement('div');
hudContainer.id = 'hacks-hud';
hudContainer.innerHTML = `
<div id="hacks-hud-header">
<span id="hacks-hud-title">MathsOnline Hacks v1.6</span>
<button id="hacks-hud-toggle-btn">HIDE (H)</button>
</div>
<div id="hacks-hud-body">
<div style="color: #888; text-align: center;">Awaiting active question...</div>
</div>
`;
document.body.appendChild(hudContainer);
hudContent = document.getElementById('hacks-hud-body');
document.getElementById('hacks-hud-toggle-btn').addEventListener('click', toggleHUD);
makeDraggable(hudContainer);
}
// Drag and Drop Logic
function makeDraggable(element) {
const header = document.getElementById('hacks-hud-header');
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
header.onmousedown = dragMouseDown;
function dragMouseDown(e) {
if (e.target.id === 'hacks-hud-toggle-btn') return;
e = e || window.event;
e.preventDefault();
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
const newTop = element.offsetTop - pos2;
const newLeft = element.offsetLeft - pos1;
element.style.top = newTop + "px";
element.style.left = newLeft + "px";
element.style.right = "auto";
}
function closeDragElement() {
document.onmouseup = null;
document.onmousemove = null;
}
}
function toggleHUD() {
isHidden = !isHidden;
if (isHidden) {
hudContainer.classList.add('hacks-hidden-hud');
} else {
hudContainer.classList.remove('hacks-hidden-hud');
}
}
window.addEventListener('keydown', (e) => {
if (e.key.toLowerCase() === 'h') {
toggleHUD();
}
});
function updateHUD(answers) {
if (!hudContent) return;
if (answers.length === 0) {
hudContent.innerHTML = `<div style="color: #888; text-align: center;">No inputs detected in payload.</div>`;
return;
}
let html = '';
answers.forEach(item => {
html += `
<div class="hacks-answer-row">
<span class="hacks-label">Input #${parseInt(item.ComponentID) + 1}:</span>
<span class="hacks-val">${item.Answer}</span>
</div>
`;
});
hudContent.innerHTML = html;
}
function analyzeAndProcess(rawText) {
const trimmed = rawText.trim();
if (trimmed.startsWith('{') && (trimmed.includes('"components"') || trimmed.includes('"userQuestionSetId"'))) {
try {
const data = JSON.parse(trimmed);
if (data && data.components) {
const answersFound = [];
data.components.forEach(comp => {
if (comp.ComponentTypeID === "2" && comp.Data) {
try {
const parsedData = JSON.parse(comp.Data);
if (parsedData.Answers) {
answersFound.push({
ComponentID: comp.ComponentID,
Answer: parsedData.Answers
});
}
} catch (innerErr) {}
}
});
updateHUD(answersFound);
}
} catch (e) {}
}
}
const originalFetch = window.fetch;
window.fetch = async function(...args) {
const response = await originalFetch(...args);
try {
const clone = response.clone();
const text = await clone.text();
analyzeAndProcess(text);
} catch (e) {}
return response;
};
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this.addEventListener('readystatechange', function() {
if (this.readyState === 4 && this.status === 200) {
try {
analyzeAndProcess(this.responseText);
} catch (e) {}
}
});
return originalOpen.apply(this, arguments);
};
window.addEventListener('DOMContentLoaded', () => {
injectStyles();
createHUD();
});
})();