NitroMath Login Automation

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);
})();