Nitro Type Focus Mode

Toggle focus mode on Nitro Type with "=" key to hide distractions and improve focus.

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         Nitro Type Focus Mode
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Toggle focus mode on Nitro Type with "=" key to hide distractions and improve focus.
// @author       King's Group
// @match        https://www.nitrotype.com/*
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let focusMode = false;
    const dimOverlay = document.createElement("div");
    dimOverlay.style.position = "fixed";
    dimOverlay.style.top = "0";
    dimOverlay.style.left = "0";
    dimOverlay.style.width = "100%";
    dimOverlay.style.height = "100%";
    dimOverlay.style.backgroundColor = "rgba(0, 0, 0, 0.4)";
    dimOverlay.style.zIndex = "999";
    dimOverlay.style.pointerEvents = "none";
    dimOverlay.style.transition = "opacity 0.4s ease";
    dimOverlay.style.opacity = "0";
    document.body.appendChild(dimOverlay);

    function toggleFocusMode() {
        focusMode = !focusMode;
        const elementsToHide = [
            "#header", 
            ".race-results", 
            ".race-chat", 
            ".race-track .opponents", 
            ".garage-banner", 
            ".adsbygoogle",
            "#footer",
            ".race-rankings",
            ".social-container",
            ".friends-list"
        ];

        elementsToHide.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => {
                el.style.transition = "opacity 0.4s ease";
                el.style.opacity = focusMode ? "0" : "1";
                el.style.pointerEvents = focusMode ? "none" : "auto";
            });
        });

        dimOverlay.style.opacity = focusMode ? "1" : "0";
        console.log(`🎯 Focus Mode: ${focusMode ? "ON" : "OFF"}`);
    }

    // Listen for "=" key press
    document.addEventListener("keydown", (e) => {
        if (e.key === "=") {
            toggleFocusMode();
        }
    });

})();