Skip to content

Instantly share code, notes, and snippets.

@kevincennis
Created June 7, 2018 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevincennis/d534b5aab27194f039f45e0dc876e8a6 to your computer and use it in GitHub Desktop.
Save kevincennis/d534b5aab27194f039f45e0dc876e8a6 to your computer and use it in GitHub Desktop.
ultra-retro
( () => {
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