(function() {
    const IS_LOCAL = true,
        URL_REMOTE = "https://rawgit.com/ultratype/UltraTypeBot/master/OUT/OUT.js",
        URL_OUT = IS_LOCAL ? chrome.extension.getURL('OUT/OUT.js') : URL_REMOTE,
        injectFull = () => {
            window.stop();
            document.documentElement.innerHTML = null;
            let x = new XMLHttpRequest();
            x.open('GET', window.location.href, true);
            x.onload = function(e) {
                const doc = `<script src="${URL_OUT}"></script>\n${e.responseText}`;
                document.open();
                document.write(doc);
                document.close();
            }
        },
        injectAppend = () => {
            let scr = document.createElement('script');
            scr.src = URL_OUT;
            if (document.head) {
                document.head.appendChild(scr);
            } else {
                // Retry after about 100 ms
                setTimeout(injectAppend, 100);
            }
        };
    if (window.location.href.includes('nitrotype.com/race')) {
        // Use full injection method on the main page
        injectFull();
        return;
    }  else {
        // Slower append injection method is used
        injectAppend();
    }
})();
(function() {
    const IS_LOCAL = true,
        URL_REMOTE = "https://rawgit.com/ultratype/UltraTypeBot/master/OUT/OUT.js",
        URL_OUT = IS_LOCAL ? chrome.extension.getURL('OUT/OUT.js') : URL_REMOTE,
        injectFull = () => {
            window.stop();
            document.documentElement.innerHTML = null;
            let x = new XMLHttpRequest();
            x.open('GET', window.location.href, true);
            x.onload = function(e) {
                const doc = `<script src="${URL_OUT}"></script>\n${e.responseText}`;
                document.open();
                document.write(doc);
                document.close();
            }
        },
        injectAppend = () => {
            let scr = document.createElement('script');
            scr.src = URL_OUT;
            if (document.head) {
                document.head.appendChild(scr);
            } else {
                // Retry after about 100 ms
                setTimeout(injectAppend, 100);
            }
        };
    if (window.location.href.includes('nitrotype.com/race')) {
        // Use full injection method on the main page
        console.log('Injecting ultratype with "full" injection method.');
        injectFull();
        return;
    }  else {
        // Slower append injection method is used
        injectAppend();
    }
})();
debug logging