Benur21 / Bloons Tower Defense 5 Fullscreen

// ==UserScript==
// @name         Bloons Tower Defense 5 Fullscreen
// @namespace    https://ninjakiwi.com/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html
// @version      1.0
// @description  Makes BTD5 fullscreen. Press F and S AFTER game loading (the part when the ninja is walking/jumping at night). For Google Chrome.
// @author       Benur21
// @match        https://ninjakiwi.com/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var done = false;
    var lastKey;
    var FisDown = false;
    var SisDown = false;
    document.body.onkeydown = function (event) {
        lastKey = event.which || event.keyCode;
        if (lastKey === 70) {
            FisDown = true;
        }
        if (lastKey === 83) {
            SisDown = true;
        }
        if (FisDown && SisDown && !done) {
            makeFullscreen();
            done = true;
        }
    };

    function makeFullscreen() {
        console.clear();
        var game = document.getElementById('game');
        var body = document.getElementById('play-page');
        var content = document.getElementById('content');
        var primary = document.getElementById('primary');
        var gameContainer = document.getElementById('game_container');
        var pageCSS = document.getElementsByTagName('link')[3];
        game.width = screen.width;
        game.height = screen.height;
        body.style.margin = '0px';
        content.style.margin = '0px';
        primary.style.margin = '0px';
        gameContainer.style.margin = '0px';
        gameContainer.style.width = screen.width + 'px';
        gameContainer.style.height = screen.height + 'px';
        pageCSS.href = '';
        while (body.hasChildNodes() && body.firstChild !== content) {
            if (body.firstChild !== content) {
                body.removeChild(body.firstChild);
            }
        }
        while (body.hasChildNodes() && body.lastChild !== content) {
            if (body.lastChild !== content) {
                body.removeChild(body.lastChild);
            }
        }
        while (content.hasChildNodes() && content.firstChild !== primary) {
            if (content.firstChild !== primary) {
                content.removeChild(content.firstChild);
            }
        }
        while (content.hasChildNodes() && content.lastChild !== primary) {
            if (content.lastChild !== primary) {
                content.removeChild(content.lastChild);
            }
        }
        while (primary.hasChildNodes() && primary.firstChild !== gameContainer) {
            if (primary.firstChild !== gameContainer) {
                primary.removeChild(primary.firstChild);
            }
        }
        while (primary.hasChildNodes() && primary.lastChild !== gameContainer) {
            if (primary.lastChild !== gameContainer) {
                primary.removeChild(primary.lastChild);
            }
        }
        console.log("Game Is Now In Fullscreen.");
    }

})();