NitroMath Login Automation

Automate NitroMath login actions using Google Login. Works well with NitroMath Bot.

// ==UserScript==
// @name         NitroMath Login Automation
// @namespace    https://singdev.wixsite.com/sing-developments/
// @version      12.0
// @description  Automate NitroMath login actions using Google Login. Works well with NitroMath Bot.
// @author       Sing Developments
// @match        https://www.nitromath.com/*
// @grant        none
// ==/UserScript==

(function() {
    // Function to check the current URL and perform actions accordingly
    function checkURL() {
        if (window.location.href.includes('https://www.nitromath.com/login')) {
            // Redirect to the Google Login page.
            window.location.href = 'https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?client_id=530728710703.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fwww.nitromath.com%2Foauth%3Ftype%3Dgoogle&scope=openid%20profile%20email&response_type=code&service=lso&o2v=1&theme=glif&flowName=GeneralOAuthFlow';
            console.log('Logging In.');
            // Wait until the login page loads again
            var loginInterval = setInterval(function() {
                if (window.location.href.includes('https://www.nitromath.com/login')) {
                    clearInterval(loginInterval); // Stop checking
                    // Redirect to the Google Login page again
                    window.location.href = 'https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?client_id=530728710703.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fwww.nitromath.com%2Foauth%3Ftype%3Dgoogle&scope=openid%20profile%20email&response_type=code&service=lso&o2v=1&theme=glif&flowName=GeneralOAuthFlow';
                    console.log('Logging In Again.');
                }
            }, 1000); // Check every second
        } else if (window.location.href.includes('https://www.nitromath.com/garage')) {
            // If on the garage page, redirect to the race page.
            window.location.href = 'https://www.nitromath.com/play';
            console.log('Going to race from garage.');
        }
    }

    // Repeat the loop every 2 seconds
    setInterval(checkURL, 2000);
})();