LeeSpork / Pxls.space: change overlay opacity on keypress

// ==UserScript==
// @name         Pxls.space: change overlay opacity on keypress
// @namespace    http://tampermonkey.net/
// @version      r1e1
// @description  When you press any key in pxls.space, the overlay/template will toggle between opactiy 1 and 0.
// @author       LeeSpork
// @match        http://pxls.space/*
// @match        https://pxls.space/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log("Initiating keybinds from LeeSpork's code");

    var elements = document.getElementsByClassName('board-template pixelate');
    //var elements = document.getElementsByTagName('img');

    function KeyCheck(e)
    {
        //console.log("Checking the Keycheck check is good!");
        console.log("You pressed",e.keyCode);

        if(elements[0].style.opacity == 1)
            elements[0].style.opacity = 0;

        else if(elements[0].style.opacity !== 1)
            elements[0].style.opacity = 1;
/*
        if(e.keyCode==69)
            elements[0].style.opacity = 0;

        if(e.keyCode==82)
            elements[0].style.opacity = 1;
*/
    }
    window.addEventListener('keydown', KeyCheck, true);
})();