Miacademy Answer Cheat

Automatically marks all answers as correct

Size

6.0 KB

Version

1.1.4

Created

Jan 21, 2026

Updated

27 days ago

1// ==UserScript==
2// @name		Miacademy Answer Cheat
3// @description		Automatically marks all answers as correct
4// @version		1.1.4
5// @match		https://*.miacademy.co/*
6// @icon		https://miacademy.co/generated/static-images/miacademy/shared/favicon.ico
7// @grant		GM.xmlhttpRequest
8// ==/UserScript==
9(function() {
10    'use strict';
11
12    console.log('Miacademy Answer Cheat with Answer Highlighter loaded');
13
14    // Function to highlight the correct answer
15    function highlightCorrectAnswer() {
16        try {
17            // Get the question text
18            const questionElement = document.querySelector('.mia-promptText .mia-TextBlock');
19            if (!questionElement) {
20                console.log('No question found');
21                return;
22            }
23
24            const questionText = questionElement.textContent.trim();
25            console.log('Question:', questionText);
26
27            // Parse math questions (multiplication, addition, subtraction, division)
28            let correctAnswer = null;
29            
30            // Match patterns like "What is 11 × 13?" or "11 × 13 = ?"
31            const multiplyMatch = questionText.match(/(\d+)\s*[×x*]\s*(\d+)/i);
32            const addMatch = questionText.match(/(\d+)\s*\+\s*(\d+)/);
33            const subtractMatch = questionText.match(/(\d+)\s*[-−]\s*(\d+)/);
34            const divideMatch = questionText.match(/(\d+)\s*[÷/]\s*(\d+)/);
35
36            if (multiplyMatch) {
37                const num1 = parseInt(multiplyMatch[1]);
38                const num2 = parseInt(multiplyMatch[2]);
39                correctAnswer = num1 * num2;
40                console.log(`Multiplication: ${num1} × ${num2} = ${correctAnswer}`);
41            } else if (addMatch) {
42                const num1 = parseInt(addMatch[1]);
43                const num2 = parseInt(addMatch[2]);
44                correctAnswer = num1 + num2;
45                console.log(`Addition: ${num1} + ${num2} = ${correctAnswer}`);
46            } else if (subtractMatch) {
47                const num1 = parseInt(subtractMatch[1]);
48                const num2 = parseInt(subtractMatch[2]);
49                correctAnswer = num1 - num2;
50                console.log(`Subtraction: ${num1} - ${num2} = ${correctAnswer}`);
51            } else if (divideMatch) {
52                const num1 = parseInt(divideMatch[1]);
53                const num2 = parseInt(divideMatch[2]);
54                correctAnswer = num1 / num2;
55                console.log(`Division: ${num1} ÷ ${num2} = ${correctAnswer}`);
56            }
57
58            if (correctAnswer !== null) {
59                // Find all answer options
60                const answerElements = document.querySelectorAll('.mia-SelectableAnswer.mia-answer');
61                console.log(`Found ${answerElements.length} answer options`);
62
63                answerElements.forEach((answerEl, index) => {
64                    const answerTextEl = answerEl.querySelector('.mia-TextBlock');
65                    if (answerTextEl) {
66                        const answerText = answerTextEl.textContent.trim();
67                        const answerValue = parseFloat(answerText);
68                        
69                        console.log(`Answer ${index + 1}: ${answerText} (value: ${answerValue})`);
70
71                        // Remove any previous highlighting
72                        answerEl.style.border = '';
73                        answerEl.style.backgroundColor = '';
74                        answerEl.style.boxShadow = '';
75
76                        // Highlight the correct answer
77                        if (answerValue === correctAnswer) {
78                            console.log(`✓ CORRECT ANSWER FOUND: ${answerText}`);
79                            answerEl.style.border = '3px solid #00ff00';
80                            answerEl.style.backgroundColor = 'rgba(0, 255, 0, 0.1)';
81                            answerEl.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';
82                            
83                            // Add a checkmark indicator
84                            let indicator = answerEl.querySelector('.correct-answer-indicator');
85                            if (!indicator) {
86                                indicator = document.createElement('div');
87                                indicator.className = 'correct-answer-indicator';
88                                indicator.textContent = '✓ CORRECT';
89                                indicator.style.cssText = 'position: absolute; top: 5px; right: 5px; background: #00ff00; color: #000; padding: 2px 8px; border-radius: 3px; font-weight: bold; font-size: 12px; z-index: 1000;';
90                                answerEl.style.position = 'relative';
91                                answerEl.appendChild(indicator);
92                            }
93                        }
94                    }
95                });
96            } else {
97                console.log('Could not parse question to find correct answer');
98            }
99        } catch (error) {
100            console.error('Error highlighting correct answer:', error);
101        }
102    }
103
104    // Monitor for new questions
105    function observeQuestions() {
106        const observer = new MutationObserver(() => {
107            // Debounce the highlighting
108            clearTimeout(window.highlightTimeout);
109            window.highlightTimeout = setTimeout(() => {
110                highlightCorrectAnswer();
111            }, 300);
112        });
113
114        observer.observe(document.body, {
115            childList: true,
116            subtree: true
117        });
118
119        console.log('Question observer active');
120    }
121
122    // Initialize
123    function init() {
124        console.log('Initializing answer highlighter...');
125        
126        // Highlight current question
127        setTimeout(() => {
128            highlightCorrectAnswer();
129        }, 1000);
130
131        // Start observing for new questions
132        observeQuestions();
133    }
134
135    // Start when page is ready
136    if (document.readyState === 'loading') {
137        document.addEventListener('DOMContentLoaded', init);
138    } else {
139        init();
140    }
141
142    console.log('Miacademy Answer Cheat fully active - correct answers will be highlighted!');
143})();
Miacademy Answer Cheat | Robomonkey