Created
June 7, 2018 15:53
-
-
Save kevincennis/d534b5aab27194f039f45e0dc876e8a6 to your computer and use it in GitHub Desktop.
ultra-retro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( () => { | |
const expect = [ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65 ]; | |
const pressed = []; | |
document.addEventListener( 'keyup', e => { | |
pressed.push( e.keyCode ); | |
for ( let i = 0; i < pressed.length; ++i ) { | |
if ( pressed[ i ] !== expect[ i ] ) { | |
pressed.length = 0; | |
break; | |
} | |
} | |
if ( pressed.length === expect.length ) { | |
const links = document.getElementsByTagName('link'); | |
[ ...links ].forEach( el => { | |
if ( el.rel === 'stylesheet' ) { | |
el.parentElement.removeChild( el ); | |
} | |
}); | |
pressed.length = 0; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment