您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a tutor box to Mathspace with a calculator UI (buttons don't work yet)
当前为
// ==UserScript== // @name Mathspace Tutor Box // @namespace http://tampermonkey.net/ // @version 1.7 // @description Adds a tutor box to Mathspace with a calculator UI (buttons don't work yet) // @author Your Name // @match *://*.mathspace.co/* // @grant none // ==/UserScript== (function() { 'use strict'; function createTutorBox() { // Remove existing box if it already exists let existingBox = document.getElementById("mathspace-tutor"); if (existingBox) existingBox.remove(); // Create the floating box let tutorBox = document.createElement("div"); tutorBox.id = "mathspace-tutor"; tutorBox.style.position = "fixed"; tutorBox.style.bottom = "20px"; tutorBox.style.right = "20px"; tutorBox.style.background = "#0073e6"; tutorBox.style.color = "white"; tutorBox.style.padding = "15px"; tutorBox.style.borderRadius = "8px"; tutorBox.style.boxShadow = "0px 0px 10px rgba(0,0,0,0.2)"; tutorBox.style.cursor = "pointer"; tutorBox.style.zIndex = "1000"; tutorBox.style.fontSize = "16px"; tutorBox.style.fontWeight = "bold"; tutorBox.innerText = "Mathematical Tutor"; // Add click event tutorBox.addEventListener("click", function() { tutorBox.innerText = "Analysing..."; setTimeout(() => { tutorBox.innerText = "Analysing the Question..."; setTimeout(() => { tutorBox.innerText = "Fetching tools..."; setTimeout(() => { tutorBox.innerText = "IF YOU WANT TO WRITE THE QUESTION, PLEASE HOLD AND THEN WRITE..."; setTimeout(() => { tutorBox.innerText = "Did you know the creator was a 13-year-old kid?"; setTimeout(() => { captureProblem(tutorBox); // Move to the next step }, 2000); }, 2000); }, 2000); }, 2000); }, 2000); }); // Add to the page document.body.appendChild(tutorBox); } function captureProblem(tutorBox) { let problemText = getMathProblem(); // If problem isn't found, immediately ask for manual input if (problemText === "Problem not found!") { manualProblemInput(tutorBox); return; } // Otherwise, ask if the detected problem is correct tutorBox.style.width = "350px"; tutorBox.style.height = "auto"; tutorBox.style.padding = "20px"; tutorBox.innerHTML = ` <b>Is this the correct problem?</b><br><br> <i>${problemText}</i><br><br> <button id="confirmProblem" style="margin-right: 10px; background: green; color: white; padding: 5px; border: none; cursor: pointer;">Yes, it is right</button> <button id="editProblem" style="background: red; color: white; padding: 5px; border: none; cursor: pointer;">No, let me type it in</button> <div id="manualInput" style="margin-top: 10px; display: none;"> <input type="text" id="manualProblem" style="width: 90%;" placeholder="Type the problem here..."> <button id="submitProblem" style="background: blue; color: white; padding: 5px; border: none; cursor: pointer;">Submit</button> </div> `; document.getElementById("confirmProblem").addEventListener("click", () => { showCalculator(tutorBox); }); document.getElementById("editProblem").addEventListener("click", () => { document.getElementById("manualInput").style.display = "block"; }); document.getElementById("submitProblem").addEventListener("click", () => { let userInput = document.getElementById("manualProblem").value; if (userInput.trim() === "") return; // Prevent empty input tutorBox.innerHTML = `<b>Question received:</b> <br><br> <i>${userInput}</i> <br><br> Analysing and solving...`; setTimeout(() => { showCalculator(tutorBox); }, 2000); }); } function manualProblemInput(tutorBox) { tutorBox.style.width = "350px"; tutorBox.style.height = "auto"; tutorBox.style.padding = "20px"; tutorBox.innerHTML = ` <b>Type the problem:</b><br><br> <input type="text" id="manualProblem" style="width: 90%;" placeholder="Type the problem here..."> <button id="submitProblem" style="background: blue; color: white; padding: 5px; border: none; cursor: pointer;">Submit</button> `; // Keep input box until submit is pressed document.getElementById("submitProblem").addEventListener("click", () => { let userInput = document.getElementById("manualProblem").value; if (userInput.trim() === "") return; // Prevent empty input tutorBox.innerHTML = `<b>Question received:</b> <br><br> <i>${userInput}</i> <br><br> Analysing and solving...`; setTimeout(() => { showCalculator(tutorBox); }, 2000); }); } function showCalculator(tutorBox) { tutorBox.innerHTML = ` <b>Simple Calculator</b><br><br> <div id="calcDisplay" style="width: 90%; height: 30px; background: white; color: black; text-align: right; padding: 5px; font-size: 18px; border: 1px solid #ccc;">0</div> <br> <div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px;"> <button class="calcBtn">7</button> <button class="calcBtn">8</button> <button class="calcBtn">9</button> <button class="calcBtn">+</button> <button class="calcBtn">4</button> <button class="calcBtn">5</button> <button class="calcBtn">6</button> <button class="calcBtn">-</button> <button class="calcBtn">1</button> <button class="calcBtn">2</button> <button class="calcBtn">3</button> <button class="calcBtn">×</button> <button class="calcBtn">0</button> <button class="calcBtn">.</button> <button class="calcBtn">÷</button> <button class="calcBtn">=</button> </div> `; // Disable buttons for now (they don't do anything yet) document.querySelectorAll(".calcBtn").forEach(button => { button.addEventListener("click", () => { console.log("Button pressed: " + button.innerText); }); }); } function getMathProblem() { let problemElement = document.querySelector('[data-testid="question-content"]'); // Change this selector if needed return problemElement ? problemElement.innerText.trim() : "Problem not found!"; } // Ensure the script runs when the page is fully loaded window.addEventListener("load", createTutorBox); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址