Mathspace Enhancement

Enhances Mathspace with helpful features.

  1. // ==UserScript==
  2. // @name Mathspace Enhancement
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Enhances Mathspace with helpful features.
  6. // @author You
  7. // @match https://mathspace.co/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Add a button to reveal hints more easily (if available)
  15. function addHintButton() {
  16. const hintButton = document.querySelector('button[aria-label*="Hint"]');
  17. if (hintButton) {
  18. hintButton.style.backgroundColor = 'lightgreen'; // Make it more visible
  19. hintButton.style.color = 'black';
  20. hintButton.style.fontWeight = 'bold';
  21. hintButton.addEventListener('click', function() {
  22. console.log("Hint button clicked!"); // Optional: Log to console
  23. });
  24. }
  25. }
  26.  
  27. // Make important elements more visible (e.g., question area)
  28. function enhanceVisibility() {
  29. const questionArea = document.querySelector('.question-container'); // Adjust selector as needed
  30. if (questionArea) {
  31. questionArea.style.border = '2px solid blue'; // Highlight the question area
  32. }
  33. }
  34.  
  35. // Add a quick link to the Mathspace help center
  36. function addHelpLink() {
  37. const helpLink = document.createElement('a');
  38. helpLink.href = 'https://help.mathspace.co/'; // Replace with the correct help URL
  39. helpLink.textContent = 'Mathspace Help';
  40. helpLink.target = '_blank'; // Open in a new tab
  41. helpLink.style.display = 'block';
  42. helpLink.style.marginTop = '10px';
  43. document.body.appendChild(helpLink); // Or append to a more appropriate container
  44. }
  45.  
  46. // Observe changes in the DOM to dynamically add features as Mathspace loads content.
  47. const observer = new MutationObserver(function(mutations) {
  48. addHintButton();
  49. enhanceVisibility();
  50. });
  51.  
  52. observer.observe(document.body, {
  53. childList: true,
  54. subtree: true
  55. });
  56.  
  57. // Initial run
  58. addHintButton();
  59. enhanceVisibility();
  60. addHelpLink();
  61.  
  62. })();