Mathspace Confidence Booster

Adds confidence points to the leaderboard to motivate students on MathsSpace.co

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         Mathspace Confidence Booster
// @namespace    http://mathsspace.co/
// @version      1.0
// @description  Adds confidence points to the leaderboard to motivate students on MathsSpace.co
// @author       CodeCopilot
// @match        *://*.mathsspace.co/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    console.log("[MathsSpace Booster] Script Loaded ✅");

    function addConfidencePoints() {
        let correctMessage = document.querySelector(".correct-answer-message"); // Adjust if needed
        let leaderboard = document.querySelector(".leaderboard-score"); // Adjust if needed

        if (correctMessage && leaderboard) {
            let currentScore = parseInt(leaderboard.innerText, 10) || 0;
            let extraPoints = 50; // Confidence Boost
            let newScore = currentScore + extraPoints;

            leaderboard.innerText = newScore;
            showMotivationMessage(correctMessage, extraPoints);
        }
    }

    function showMotivationMessage(targetNode, points) {
        let messageBox = document.createElement("div");
        messageBox.className = "confidence-message";
        messageBox.style.background = "#4CAF50";
        messageBox.style.color = "#fff";
        messageBox.style.padding = "10px";
        messageBox.style.marginTop = "10px";
        messageBox.style.borderRadius = "5px";
        messageBox.style.fontWeight = "bold";
        messageBox.style.textAlign = "center";
        messageBox.innerText = `🎉 Great job! +${points} Confidence Points! 🎉`;

        targetNode.appendChild(messageBox);

        setTimeout(() => messageBox.remove(), 3000); // Hide after 3 seconds
    }

    function watchForChanges() {
        let observer = new MutationObserver(() => addConfidencePoints());
        observer.observe(document.body, { childList: true, subtree: true });
        console.log("[MathsSpace Booster] Watching for achievements...");
    }

    watchForChanges();
})();