Mathspace Tutor Box

Adds a tutor box to Mathspace with a number-only calculator UI (no functionality yet)

  1. // ==UserScript==
  2. // @name Mathspace Tutor Box
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.7
  5. // @description Adds a tutor box to Mathspace with a number-only calculator UI (no functionality yet)
  6. // @author Your Name
  7. // @match *://*.mathspace.co/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function createTutorBox() {
  15. // Remove existing box if it already exists
  16. let existingBox = document.getElementById("mathspace-tutor");
  17. if (existingBox) existingBox.remove();
  18.  
  19. // Create the floating box
  20. let tutorBox = document.createElement("div");
  21. tutorBox.id = "mathspace-tutor";
  22. tutorBox.style.position = "fixed";
  23. tutorBox.style.bottom = "20px";
  24. tutorBox.style.right = "20px";
  25. tutorBox.style.background = "#0073e6";
  26. tutorBox.style.color = "white";
  27. tutorBox.style.padding = "15px";
  28. tutorBox.style.borderRadius = "8px";
  29. tutorBox.style.boxShadow = "0px 0px 10px rgba(0,0,0,0.2)";
  30. tutorBox.style.cursor = "pointer";
  31. tutorBox.style.zIndex = "1000";
  32. tutorBox.style.fontSize = "16px";
  33. tutorBox.style.fontWeight = "bold";
  34. tutorBox.innerText = "Mathematical Tutor";
  35.  
  36. // Add click event
  37. tutorBox.addEventListener("click", function() {
  38. tutorBox.innerText = "Analysing...";
  39. setTimeout(() => {
  40. tutorBox.innerText = "Analysing the Question...";
  41. setTimeout(() => {
  42. tutorBox.innerText = "Fetching tools...";
  43. setTimeout(() => {
  44. tutorBox.innerText = "IF YOU WANT TO WRITE THE QUESTION, PLEASE HOLD AND THEN WRITE...";
  45. setTimeout(() => {
  46. tutorBox.innerText = "Did you know the creator was a 13-year-old kid?";
  47. setTimeout(() => {
  48. captureProblem(tutorBox); // Move to the next step
  49. }, 2000);
  50. }, 2000);
  51. }, 2000);
  52. }, 2000);
  53. }, 2000);
  54. });
  55.  
  56. // Add to the page
  57. document.body.appendChild(tutorBox);
  58. }
  59.  
  60. function captureProblem(tutorBox) {
  61. let problemText = getMathProblem();
  62.  
  63. // If problem isn't found, immediately ask for manual input
  64. if (problemText === "Problem not found!") {
  65. manualProblemInput(tutorBox);
  66. return;
  67. }
  68.  
  69. // Otherwise, ask if the detected problem is correct
  70. tutorBox.style.width = "350px";
  71. tutorBox.style.height = "auto";
  72. tutorBox.style.padding = "20px";
  73. tutorBox.innerHTML = `
  74. <b>Is this the correct problem?</b><br><br>
  75. <i>${problemText}</i><br><br>
  76. <button id="confirmProblem" style="margin-right: 10px; background: green; color: white; padding: 5px; border: none; cursor: pointer;">Yes, it is right</button>
  77. <button id="editProblem" style="background: red; color: white; padding: 5px; border: none; cursor: pointer;">No, let me type it in</button>
  78. <div id="manualInput" style="margin-top: 10px; display: none;">
  79. <input type="text" id="manualProblem" style="width: 90%;" placeholder="Type the problem here...">
  80. <button id="submitProblem" style="background: blue; color: white; padding: 5px; border: none; cursor: pointer;">Submit</button>
  81. </div>
  82. `;
  83.  
  84. document.getElementById("confirmProblem").addEventListener("click", () => {
  85. showLoadingScreen(tutorBox);
  86. });
  87.  
  88. document.getElementById("editProblem").addEventListener("click", () => {
  89. document.getElementById("manualInput").style.display = "block";
  90. });
  91.  
  92. document.getElementById("submitProblem").addEventListener("click", () => {
  93. let userInput = document.getElementById("manualProblem").value;
  94. if (userInput.trim() === "") return; // Prevent empty input
  95.  
  96. tutorBox.innerHTML = `<b>Question received:</b> <br><br> <i>${userInput}</i>`;
  97. setTimeout(() => {
  98. showLoadingScreen(tutorBox);
  99. }, 2000);
  100. });
  101. }
  102.  
  103. function manualProblemInput(tutorBox) {
  104. tutorBox.style.width = "350px";
  105. tutorBox.style.height = "auto";
  106. tutorBox.style.padding = "20px";
  107. tutorBox.innerHTML = `
  108. <b>Type the problem:</b><br><br>
  109. <input type="text" id="manualProblem" style="width: 90%;" placeholder="Type the problem here...">
  110. <button id="submitProblem" style="background: blue; color: white; padding: 5px; border: none; cursor: pointer;">Submit</button>
  111. `;
  112.  
  113. document.getElementById("submitProblem").addEventListener("click", () => {
  114. let userInput = document.getElementById("manualProblem").value;
  115. if (userInput.trim() === "") return; // Prevent empty input
  116.  
  117. tutorBox.innerHTML = `<b>Question received:</b> <br><br> <i>${userInput}</i>`;
  118. setTimeout(() => {
  119. showLoadingScreen(tutorBox);
  120. }, 2000);
  121. });
  122. }
  123.  
  124. function showLoadingScreen(tutorBox) {
  125. tutorBox.innerText = "Loading and wait for your math tutor to destroy those fails and get more A's";
  126. setTimeout(() => {
  127. showNumberButtons(tutorBox);
  128. }, 3000);
  129. }
  130.  
  131. function showNumberButtons(tutorBox) {
  132. tutorBox.innerHTML = `
  133. <b>Number Selection</b><br><br>
  134. <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;">
  135. <button class="numBtn">1</button>
  136. <button class="numBtn">2</button>
  137. <button class="numBtn">3</button>
  138. <button class="numBtn">4</button>
  139. <button class="numBtn">5</button>
  140. <button class="numBtn">6</button>
  141. <button class="numBtn">7</button>
  142. <button class="numBtn">8</button>
  143. <button class="numBtn">9</button>
  144. <button class="numBtn">0</button>
  145. </div>
  146. `;
  147.  
  148. // Buttons do nothing for now
  149. document.querySelectorAll(".numBtn").forEach(button => {
  150. button.addEventListener("click", () => {
  151. console.log("Number pressed: " + button.innerText);
  152. });
  153. });
  154. }
  155.  
  156. function getMathProblem() {
  157. let problemElement = document.querySelector('[data-testid="question-content"]'); // Change this selector if needed
  158. return problemElement ? problemElement.innerText.trim() : "Problem not found!";
  159. }
  160.  
  161. // Ensure the script runs when the page is fully loaded
  162. window.addEventListener("load", createTutorBox);
  163. })();
  164.  
  165.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址