Skip to content

Instantly share code, notes, and snippets.

@kutyel
Last active February 20, 2017 08:59
Show Gist options
  • Save kutyel/5d23ee8d418320576e1d3e570c965c49 to your computer and use it in GitHub Desktop.
Save kutyel/5d23ee8d418320576e1d3e570c965c49 to your computer and use it in GitHub Desktop.
Add tdfw.js as an Easter Egg to your page using the KONAMI CODE! Use this as src: https://rawgit.com/kutyel/5d23ee8d418320576e1d3e570c965c49/raw/db7f1242c0fb2f6fb029006c12d7e3f0f847b8a0/TDFW_KONAMI_CODE.js
(function() {
'use strict'
var pressed = []
var KONAMI_CODE = [
'ArrowUp',
'ArrowUp',
'ArrowDown',
'ArrowDown',
'ArrowLeft',
'ArrowRight',
'ArrowLeft',
'ArrowRight',
'a',
'b',
'Enter'
]
function tdfw () {
var script = document.createElement('script')
script.setAttribute('src', 'https://nthitz.github.io/turndownforwhatjs/tdfw.js')
document.body.appendChild(script)
}
window.addEventListener('keyup', function (e) {
pressed.push(e.key)
pressed.splice(-KONAMI_CODE.length - 1, pressed.length - KONAMI_CODE.length)
pressed.join().indexOf(KONAMI_CODE.join()) > -1 && tdfw()
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment